update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -0,0 +1,75 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ANY_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ANY_HPP
#include <utility>
#include <boost/any.hpp>
#include <boost/geometry/geometries/adapted/detail/any.hpp>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
namespace boost { namespace geometry
{
namespace detail
{
struct boost_any_cast_policy
{
template <typename T, typename Any>
static inline T * apply(Any * any_ptr)
{
return boost::any_cast<T>(any_ptr);
}
};
} // namespace detail
namespace traits
{
template <>
struct tag<boost::any>
{
using type = dynamic_geometry_tag;
};
template <>
struct visit<boost::any>
{
template <typename Function, typename Any>
static void apply(Function && function, Any && any)
{
using types_t = typename geometry_types<util::remove_cref_t<Any>>::type;
geometry::detail::visit_any
<
geometry::detail::boost_any_cast_policy, types_t
>::template apply<0>(std::forward<Function>(function), std::forward<Any>(any));
}
};
} // namespace traits
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ANY_HPP

View File

@@ -3,6 +3,10 @@
// Copyright (c) 2010 Alfredo Correa
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 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)
@@ -21,8 +25,7 @@
#include <cstddef>
#include <boost/type_traits/is_arithmetic.hpp>
#include <type_traits>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/cs.hpp>
@@ -69,7 +72,7 @@ struct boost_array_tag<true>
// Assign the point-tag, preventing arrays of points getting a point-tag
template <typename CoordinateType, std::size_t DimensionCount>
struct tag<boost::array<CoordinateType, DimensionCount> >
: detail::boost_array_tag<boost::is_arithmetic<CoordinateType>::value> {};
: detail::boost_array_tag<std::is_arithmetic<CoordinateType>::value> {};
template <typename CoordinateType, std::size_t DimensionCount>
@@ -80,7 +83,9 @@ struct coordinate_type<boost::array<CoordinateType, DimensionCount> >
template <typename CoordinateType, std::size_t DimensionCount>
struct dimension<boost::array<CoordinateType, DimensionCount> >: boost::mpl::int_<DimensionCount> {};
struct dimension<boost::array<CoordinateType, DimensionCount> >
: std::integral_constant<std::size_t, DimensionCount>
{};
template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>

View File

@@ -3,10 +3,11 @@
// Copyright (c) 2011-2015 Akira Takahashi
// Copyright (c) 2011-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
// This file was modified by Oracle on 2015-2020.
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// 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
@@ -17,8 +18,7 @@
#include <cstddef>
#include <boost/core/enable_if.hpp>
#include <type_traits>
#include <boost/fusion/include/is_sequence.hpp>
#include <boost/fusion/include/size.hpp>
@@ -35,7 +35,6 @@
#include <boost/mpl/size.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
@@ -53,27 +52,46 @@ namespace fusion_adapt_detail
template <class Sequence>
struct all_same :
boost::mpl::bool_<
boost::mpl::count_if<
Sequence,
boost::is_same<
typename boost::mpl::front<Sequence>::type,
boost::mpl::_
>
>::value == boost::mpl::size<Sequence>::value
>
std::integral_constant
<
bool,
boost::mpl::count_if<
Sequence,
boost::is_same<
typename boost::mpl::front<Sequence>::type,
boost::mpl::_
>
>::value == boost::mpl::size<Sequence>::value
>
{};
template <class Sequence>
struct is_coordinate_size : boost::mpl::bool_<
boost::fusion::result_of::size<Sequence>::value == 2 ||
boost::fusion::result_of::size<Sequence>::value == 3> {};
struct is_coordinate_size
: std::integral_constant
<
bool,
(boost::fusion::result_of::size<Sequence>::value == 2
|| boost::fusion::result_of::size<Sequence>::value == 3)
>
{};
template
<
typename Sequence,
bool IsSequence = boost::fusion::traits::is_sequence<Sequence>::value
>
struct is_fusion_sequence
: std::integral_constant
<
bool,
(fusion_adapt_detail::is_coordinate_size<Sequence>::value
&& fusion_adapt_detail::all_same<Sequence>::value)
>
{};
template<typename Sequence>
struct is_fusion_sequence
: boost::mpl::and_<boost::fusion::traits::is_sequence<Sequence>,
fusion_adapt_detail::is_coordinate_size<Sequence>,
fusion_adapt_detail::all_same<Sequence> >
struct is_fusion_sequence<Sequence, false>
: std::false_type
{};
@@ -89,10 +107,10 @@ template <typename Sequence>
struct coordinate_type
<
Sequence,
typename boost::enable_if
std::enable_if_t
<
fusion_adapt_detail::is_fusion_sequence<Sequence>
>::type
fusion_adapt_detail::is_fusion_sequence<Sequence>::value
>
>
{
typedef typename boost::mpl::front<Sequence>::type type;
@@ -103,10 +121,10 @@ template <typename Sequence>
struct dimension
<
Sequence,
typename boost::enable_if
std::enable_if_t
<
fusion_adapt_detail::is_fusion_sequence<Sequence>
>::type
fusion_adapt_detail::is_fusion_sequence<Sequence>::value
>
> : boost::mpl::size<Sequence>
{};
@@ -116,10 +134,10 @@ struct access
<
Sequence,
Dimension,
typename boost::enable_if
std::enable_if_t
<
fusion_adapt_detail::is_fusion_sequence<Sequence>
>::type
fusion_adapt_detail::is_fusion_sequence<Sequence>::value
>
>
{
typedef typename coordinate_type<Sequence>::type ctype;
@@ -141,10 +159,10 @@ template <typename Sequence>
struct tag
<
Sequence,
typename boost::enable_if
std::enable_if_t
<
fusion_adapt_detail::is_fusion_sequence<Sequence>
>::type
fusion_adapt_detail::is_fusion_sequence<Sequence>::value
>
>
{
typedef point_tag type;
@@ -166,10 +184,10 @@ struct tag
struct coordinate_system \
< \
Sequence, \
typename boost::enable_if \
std::enable_if_t \
< \
fusion_adapt_detail::is_fusion_sequence<Sequence> \
>::type \
fusion_adapt_detail::is_fusion_sequence<Sequence>::value \
> \
> \
{ typedef CoordinateSystem type; }; \
}}}

View File

@@ -2,6 +2,10 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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)
@@ -33,12 +37,12 @@ struct holes_proxy
{
typedef ring_proxy
<
typename boost::mpl::if_
std::conditional_t
<
typename boost::is_const<Polygon>,
std::is_const<Polygon>::value,
Polygon const,
Polygon
>::type
>
> proxy_type;
typedef hole_iterator<Polygon, proxy_type> iterator_type;

View File

@@ -2,6 +2,10 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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)
@@ -13,6 +17,8 @@
// boost::polygon::point_data -> boost::geometry::point
#include <type_traits>
#include <boost/polygon/polygon.hpp>
#include <boost/geometry/core/access.hpp>
@@ -54,7 +60,7 @@ struct coordinate_system<boost::polygon::point_data<CoordinateType> >
template <typename CoordinateType>
struct dimension<boost::polygon::point_data<CoordinateType> >
: boost::mpl::int_<2>
: std::integral_constant<std::size_t, 2>
{};

View File

@@ -4,8 +4,8 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2018.
// Modifications copyright (c) 2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2018-2020.
// Modifications copyright (c) 2018-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -21,6 +21,7 @@
#include <cstddef>
#include <type_traits>
#include <boost/tuple/tuple.hpp>
@@ -59,13 +60,14 @@ struct coordinate_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
struct dimension<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
: boost::mpl::int_
<
boost::tuples::length
<
boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
>::value
>
: std::integral_constant
<
std::size_t,
boost::tuples::length
<
boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
>::value
>
{};

View File

@@ -0,0 +1,175 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2018-2021.
// Modifications copyright (c) 2018-2021, 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_GEOMETRIES_ADAPTED_BOOST_VARIANT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT_HPP
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant.hpp>
//#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
#include <boost/geometry/util/sequence.hpp>
namespace boost { namespace geometry
{
namespace detail
{
template <typename Seq, typename ResultSeq = util::type_sequence<>>
struct boost_variant_types;
template <typename T, typename ...Ts, typename ...Rs>
struct boost_variant_types<util::type_sequence<T, Ts...>, util::type_sequence<Rs...>>
{
using type = typename boost_variant_types<util::type_sequence<Ts...>, util::type_sequence<Rs..., T>>::type;
};
template <typename ...Ts, typename ...Rs>
struct boost_variant_types<util::type_sequence<boost::detail::variant::void_, Ts...>, util::type_sequence<Rs...>>
{
using type = util::type_sequence<Rs...>;
};
template <typename ...Rs>
struct boost_variant_types<util::type_sequence<>, util::type_sequence<Rs...>>
{
using type = util::type_sequence<Rs...>;
};
} // namespace detail
// TODO: This is not used anywhere in the header files. Only in tests.
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct point_type<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
: point_type
<
typename util::pack_front
<
BOOST_VARIANT_ENUM_PARAMS(T)
>::type
>
{};
namespace traits
{
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct tag<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>>
{
using type = dynamic_geometry_tag;
};
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct visit<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>>
{
template <typename Function>
struct visitor
: boost::static_visitor<>
{
visitor(Function function)
: m_function(function)
{}
template <typename Geometry>
void operator()(Geometry && geometry)
{
m_function(std::forward<Geometry>(geometry));
}
Function m_function;
};
template <typename Function, typename Variant>
static void apply(Function function, Variant && variant)
{
visitor<Function> visitor(function);
boost::apply_visitor(visitor, std::forward<Variant>(variant));
}
};
template <BOOST_VARIANT_ENUM_PARAMS(typename T), BOOST_VARIANT_ENUM_PARAMS(typename U)>
struct visit<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>>
{
template <typename Function>
struct visitor
: boost::static_visitor<>
{
visitor(Function function)
: m_function(function)
{}
template <typename Geometry1, typename Geometry2>
void operator()(Geometry1 && geometry1, Geometry2 && geometry2)
{
m_function(std::forward<Geometry1>(geometry1),
std::forward<Geometry2>(geometry2));
}
Function m_function;
};
template <typename Function, typename Variant1, typename Variant2>
static void apply(Function function, Variant1 && variant1, Variant2 && variant2)
{
visitor<Function> visitor(function);
boost::apply_visitor(visitor,
std::forward<Variant1>(variant1),
std::forward<Variant2>(variant2));
}
};
#ifdef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct geometry_types<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>>
{
using type = typename geometry::detail::boost_variant_types
<
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(T)>
>::type;
};
#else // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct geometry_types<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>>
{
using type = util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(T)>;
};
#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
} // namespace traits
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT_HPP

View File

@@ -0,0 +1,73 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT2_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT2_HPP
#include <utility>
#include <boost/variant2/variant.hpp>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
#include <boost/geometry/util/sequence.hpp>
namespace boost { namespace geometry
{
namespace traits
{
template <typename ...Ts>
struct tag<boost::variant2::variant<Ts...>>
{
using type = dynamic_geometry_tag;
};
template <typename ...Ts>
struct visit<boost::variant2::variant<Ts...>>
{
template <typename Function, typename Variant>
static void apply(Function && function, Variant && variant)
{
boost::variant2::visit(std::forward<Function>(function),
std::forward<Variant>(variant));
}
};
template <typename ...Ts, typename ...Us>
struct visit<boost::variant2::variant<Ts...>, boost::variant2::variant<Us...>>
{
template <typename Function, typename Variant1, typename Variant2>
static void apply(Function && function, Variant1 && variant1, Variant2 && variant2)
{
boost::variant2::visit(std::forward<Function>(function),
std::forward<Variant1>(variant1),
std::forward<Variant2>(variant2));
}
};
template <typename ...Ts>
struct geometry_types<boost::variant2::variant<Ts...>>
{
using type = util::type_sequence<Ts...>;
};
} // namespace traits
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT2_HPP

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 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.
@@ -15,8 +19,7 @@
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP
#include <cstddef>
#include <boost/type_traits/is_arithmetic.hpp>
#include <type_traits>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/cs.hpp>
@@ -61,7 +64,7 @@ struct c_array_tag<true>
// Assign the point-tag, preventing arrays of points getting a point-tag
template <typename CoordinateType, std::size_t DimensionCount>
struct tag<CoordinateType[DimensionCount]>
: detail::c_array_tag<boost::is_arithmetic<CoordinateType>::value> {};
: detail::c_array_tag<std::is_arithmetic<CoordinateType>::value> {};
template <typename CoordinateType, std::size_t DimensionCount>
@@ -72,7 +75,9 @@ struct coordinate_type<CoordinateType[DimensionCount]>
template <typename CoordinateType, std::size_t DimensionCount>
struct dimension<CoordinateType[DimensionCount]>: boost::mpl::int_<DimensionCount> {};
struct dimension<CoordinateType[DimensionCount]>
: std::integral_constant<std::size_t, DimensionCount>
{};
template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>

View File

@@ -0,0 +1,87 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_DETAIL_ANY_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_DETAIL_ANY_HPP
#include <utility>
#include <boost/geometry/util/sequence.hpp>
#include <boost/geometry/util/type_traits_std.hpp>
namespace boost { namespace geometry
{
namespace detail
{
template
<
typename CastPolicy,
typename TypeSequence,
std::size_t N = util::sequence_size<TypeSequence>::value
>
struct visit_any
{
static const std::size_t M = N / 2;
template <std::size_t Offset, typename Function, typename Any>
static bool apply(Function && function, Any && any)
{
return visit_any<CastPolicy, TypeSequence, M>::template apply<Offset>(
std::forward<Function>(function), std::forward<Any>(any))
|| visit_any<CastPolicy, TypeSequence, N - M>::template apply<Offset + M>(
std::forward<Function>(function), std::forward<Any>(any));
}
};
template <typename CastPolicy, typename TypeSequence>
struct visit_any<CastPolicy, TypeSequence, 1>
{
template <std::size_t Offset, typename Function, typename Any>
static bool apply(Function && function, Any && any)
{
using elem_t = typename util::sequence_element<Offset, TypeSequence>::type;
using geom_t = util::transcribe_const_t<std::remove_reference_t<Any>, elem_t>;
geom_t * g = CastPolicy::template apply<geom_t>(&any);
if (g != nullptr)
{
using geom_ref_t = std::conditional_t
<
std::is_rvalue_reference<decltype(any)>::value,
geom_t&&, geom_t&
>;
function(static_cast<geom_ref_t>(*g));
return true;
}
else
{
return false;
}
}
};
template <typename CastPolicy, typename TypeSequence>
struct visit_any<CastPolicy, TypeSequence, 0>
{
template <std::size_t Offset, typename Function, typename Any>
static bool apply(Function &&, Any &&)
{
return false;
}
};
} // namespace detail
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_DETAIL_ANY_HPP

View File

@@ -0,0 +1,82 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ANY_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ANY_HPP
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX17_HDR_ANY
#include <any>
#include <utility>
#include <boost/geometry/geometries/adapted/detail/any.hpp>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
namespace boost { namespace geometry
{
namespace detail
{
struct std_any_cast_policy
{
template <typename T, typename Any>
static inline T * apply(Any * any_ptr)
{
return std::any_cast<T>(any_ptr);
}
};
} // namespace detail
namespace traits
{
template <>
struct tag<std::any>
{
using type = dynamic_geometry_tag;
};
template <>
struct visit<std::any>
{
template <typename Function, typename Any>
static void apply(Function && function, Any && any)
{
using types_t = typename geometry_types<util::remove_cref_t<Any>>::type;
geometry::detail::visit_any
<
geometry::detail::std_any_cast_policy, types_t
>::template apply<0>(std::forward<Function>(function), std::forward<Any>(any));
}
};
} // namespace traits
}} // namespace boost::geometry
#endif // BOOST_NO_CXX17_HDR_ANY
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ANY_HPP

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2016 Norbert Wenzel
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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)
@@ -14,16 +18,12 @@
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#define BOOST_GEOMETRY_ADAPTED_STD_ARRAY_TAG_DEFINED
#include <array>
#include <cstddef>
#include <boost/type_traits/is_arithmetic.hpp>
#include <type_traits>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/cs.hpp>
@@ -31,7 +31,6 @@
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <array>
namespace boost { namespace geometry
{
@@ -70,7 +69,7 @@ struct std_array_tag<true>
// Assign the point-tag, preventing arrays of points getting a point-tag
template <typename CoordinateType, std::size_t DimensionCount>
struct tag<std::array<CoordinateType, DimensionCount> >
: detail::std_array_tag<boost::is_arithmetic<CoordinateType>::value> {};
: detail::std_array_tag<std::is_arithmetic<CoordinateType>::value> {};
template <typename CoordinateType, std::size_t DimensionCount>
@@ -81,7 +80,9 @@ struct coordinate_type<std::array<CoordinateType, DimensionCount> >
template <typename CoordinateType, std::size_t DimensionCount>
struct dimension<std::array<CoordinateType, DimensionCount> >: boost::mpl::int_<DimensionCount> {};
struct dimension<std::array<CoordinateType, DimensionCount> >
: std::integral_constant<std::size_t, DimensionCount>
{};
template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>
@@ -116,15 +117,5 @@ struct access<std::array<CoordinateType, DimensionCount>, Dimension>
}; \
}}}
#else
#warning "This file requires compiler and library support for the ISO C++ 2011 standard."
#endif // BOOST_NO_CXX11_HDR_ARRAY
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ARRAY_HPP

View File

@@ -0,0 +1,80 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_VARIANT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_VARIANT_HPP
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX17_HDR_VARIANT
#include <utility>
#include <variant>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
#include <boost/geometry/util/sequence.hpp>
namespace boost { namespace geometry
{
namespace traits
{
template <typename ...Ts>
struct tag<std::variant<Ts...>>
{
using type = dynamic_geometry_tag;
};
template <typename ...Ts>
struct visit<std::variant<Ts...>>
{
template <typename Function, typename Variant>
static void apply(Function && function, Variant && variant)
{
std::visit(std::forward<Function>(function),
std::forward<Variant>(variant));
}
};
template <typename ...Ts, typename ...Us>
struct visit<std::variant<Ts...>, std::variant<Us...>>
{
template <typename Function, typename Variant1, typename Variant2>
static void apply(Function && function, Variant1 && variant1, Variant2 && variant2)
{
std::visit(std::forward<Function>(function),
std::forward<Variant1>(variant1),
std::forward<Variant2>(variant2));
}
};
template <typename ...Ts>
struct geometry_types<std::variant<Ts...>>
{
using type = util::type_sequence<Ts...>;
};
} // namespace traits
}} // namespace boost::geometry
#endif // BOOST_NO_CXX17_HDR_VARIANT
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_VARIANT_HPP

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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.
@@ -15,11 +19,18 @@
#define BOOST_GEOMETRY_GEOMETRIES_BOX_HPP
#include <cstddef>
#include <type_traits>
#include <boost/concept/assert.hpp>
#include <boost/config.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/make.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
@@ -57,17 +68,15 @@ class box
public:
// TODO: constexpr requires LiteralType and until C++20
// it has to have trivial destructor which makes access
// debugging impossible with constexpr.
#if !defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
/// \constructor_default_no_init
box() = default;
#else
/// \constructor_default_no_init
inline box()
{}
#endif
constexpr box() = default;
#else // defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
inline box()
box()
{
m_created = 1;
}
@@ -80,7 +89,16 @@ public:
/*!
\brief Constructor taking the minimum corner point and the maximum corner point
*/
inline box(Point const& min_corner, Point const& max_corner)
template
<
typename P = Point,
std::enable_if_t
<
! std::is_copy_constructible<P>::value,
int
> = 0
>
box(Point const& min_corner, Point const& max_corner)
{
geometry::convert(min_corner, m_min_corner);
geometry::convert(max_corner, m_max_corner);
@@ -90,14 +108,45 @@ public:
#endif
}
inline Point const& min_corner() const
/*!
\brief Constructor taking the minimum corner point and the maximum corner point
*/
template
<
typename P = Point,
std::enable_if_t
<
std::is_copy_constructible<P>::value,
int
> = 0
>
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
box(Point const& min_corner, Point const& max_corner)
: m_min_corner(min_corner)
, m_max_corner(max_corner)
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
m_created = 1;
#endif
}
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
Point const& min_corner() const
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
BOOST_GEOMETRY_ASSERT(m_created == 1);
#endif
return m_min_corner;
}
inline Point const& max_corner() const
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
Point const& max_corner() const
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
BOOST_GEOMETRY_ASSERT(m_created == 1);
@@ -105,14 +154,15 @@ public:
return m_max_corner;
}
inline Point& min_corner()
Point& min_corner()
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
BOOST_GEOMETRY_ASSERT(m_created == 1);
#endif
return m_min_corner;
}
inline Point& max_corner()
Point& max_corner()
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
BOOST_GEOMETRY_ASSERT(m_created == 1);
@@ -156,12 +206,12 @@ struct indexed_access<model::box<Point>, min_corner, Dimension>
{
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
static inline coordinate_type get(model::box<Point> const& b)
static constexpr coordinate_type get(model::box<Point> const& b)
{
return geometry::get<Dimension>(b.min_corner());
}
static inline void set(model::box<Point>& b, coordinate_type const& value)
static void set(model::box<Point>& b, coordinate_type const& value)
{
geometry::set<Dimension>(b.min_corner(), value);
}
@@ -172,17 +222,31 @@ struct indexed_access<model::box<Point>, max_corner, Dimension>
{
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
static inline coordinate_type get(model::box<Point> const& b)
static constexpr coordinate_type get(model::box<Point> const& b)
{
return geometry::get<Dimension>(b.max_corner());
}
static inline void set(model::box<Point>& b, coordinate_type const& value)
static void set(model::box<Point>& b, coordinate_type const& value)
{
geometry::set<Dimension>(b.max_corner(), value);
}
};
template <typename Point>
struct make<model::box<Point> >
{
typedef model::box<Point> box_type;
static const bool is_specialized = true;
static constexpr box_type apply(Point const& min_corner, Point const& max_corner)
{
return box_type(min_corner, max_corner);
}
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS

View File

@@ -24,25 +24,12 @@
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief Box concept
\ingroup concepts
\par Formal definition:
The box concept is defined as following:
- there must be a specialization of traits::tag defining box_tag as type
- there must be a specialization of traits::point_type to define the
underlying point type (even if it does not consist of points, it should define
this type, to indicate the points it can work with)
- there must be a specialization of traits::indexed_access, per index
(min_corner, max_corner) and per dimension, with two functions:
- get to get a coordinate value
- set to set a coordinate value (this one is not checked for ConstBox)
*/
template <typename Geometry>
class Box
{
@@ -129,6 +116,20 @@ public :
#endif
};
template <typename Geometry>
struct concept_type<Geometry, box_tag>
{
using type = Box<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, box_tag>
{
using type = ConstBox<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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.
@@ -11,21 +15,19 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
#include <boost/concept_check.hpp>
#include <boost/concept/requires.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/detail/select_geometry_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/box_concept.hpp>
#include <boost/geometry/geometries/concepts/dynamic_geometry_concept.hpp>
#include <boost/geometry/geometries/concepts/geometry_collection_concept.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
@@ -35,189 +37,22 @@
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
#include <boost/geometry/geometries/concepts/segment_concept.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
namespace boost { namespace geometry
namespace boost { namespace geometry { namespace concepts
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace concept_check
{
template <typename Concept>
class check
{
BOOST_CONCEPT_ASSERT((Concept ));
};
}} // namespace detail::concept_check
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename Geometry,
typename GeometryTag = typename geometry::tag<Geometry>::type,
bool IsConst = boost::is_const<Geometry>::type::value
>
struct check : not_implemented<GeometryTag>
{};
template <typename Geometry>
struct check<Geometry, point_tag, true>
: detail::concept_check::check<concepts::ConstPoint<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, point_tag, false>
: detail::concept_check::check<concepts::Point<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, linestring_tag, true>
: detail::concept_check::check<concepts::ConstLinestring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, linestring_tag, false>
: detail::concept_check::check<concepts::Linestring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, ring_tag, true>
: detail::concept_check::check<concepts::ConstRing<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, ring_tag, false>
: detail::concept_check::check<concepts::Ring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, polygon_tag, true>
: detail::concept_check::check<concepts::ConstPolygon<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, polygon_tag, false>
: detail::concept_check::check<concepts::Polygon<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, box_tag, true>
: detail::concept_check::check<concepts::ConstBox<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, box_tag, false>
: detail::concept_check::check<concepts::Box<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, segment_tag, true>
: detail::concept_check::check<concepts::ConstSegment<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, segment_tag, false>
: detail::concept_check::check<concepts::Segment<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_point_tag, true>
: detail::concept_check::check<concepts::ConstMultiPoint<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_point_tag, false>
: detail::concept_check::check<concepts::MultiPoint<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_linestring_tag, true>
: detail::concept_check::check<concepts::ConstMultiLinestring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_linestring_tag, false>
: detail::concept_check::check<concepts::MultiLinestring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_polygon_tag, true>
: detail::concept_check::check<concepts::ConstMultiPolygon<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_polygon_tag, false>
: detail::concept_check::check<concepts::MultiPolygon<Geometry> >
{};
} // namespace dispatch
#endif
namespace concepts
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename Geometry>
struct checker : dispatch::check<Geometry>
{};
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
{};
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const>
{};
}
#endif // DOXYGEN_NO_DETAIL
/*!
\brief Checks, in compile-time, the concept of any geometry
\ingroup concepts
*/
template <typename Geometry>
// workaround for VS2015
#if !defined(_MSC_VER) || (_MSC_VER >= 1910)
constexpr
#endif
inline void check()
{
detail::checker<Geometry> c;
boost::ignore_unused(c);
BOOST_CONCEPT_ASSERT((typename concept_type<Geometry>::type));
}
@@ -227,18 +62,23 @@ inline void check()
\ingroup concepts
*/
template <typename Geometry1, typename Geometry2>
// workaround for VS2015
#if !defined(_MSC_VER) || (_MSC_VER >= 1910)
constexpr
#endif
inline void check_concepts_and_equal_dimensions()
{
check<Geometry1>();
check<Geometry2>();
assert_dimension_equal<Geometry1, Geometry2>();
assert_dimension_equal
<
typename geometry::detail::first_geometry_type<Geometry1>::type,
typename geometry::detail::first_geometry_type<Geometry2>::type
>();
}
} // namespace concepts
}} // namespace boost::geometry
}}} // namespace boost::geometry::concepts
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP

View File

@@ -0,0 +1,31 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CONCEPT_TYPE_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CONCEPT_TYPE_HPP
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
namespace boost { namespace geometry { namespace concepts
{
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
struct concept_type
{
BOOST_GEOMETRY_STATIC_ASSERT_FALSE("Not implemented for this Tag.", Tag);
};
}}} // namespace boost::geometry::concepts
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CONCEPT_TYPE_HPP

View File

@@ -0,0 +1,112 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_DYNAMIC_GEOMETRY_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_DYNAMIC_GEOMETRY_CONCEPT_HPP
#include <utility>
#include <boost/concept_check.hpp>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
#include <boost/geometry/geometries/concepts/box_concept.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/geometry_collection_concept.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
#include <boost/geometry/geometries/concepts/segment_concept.hpp>
namespace boost { namespace geometry { namespace concepts
{
namespace detail
{
template <typename Geometry, typename SubGeometry>
struct GeometryType<Geometry, SubGeometry, dynamic_geometry_tag, false>
: concepts::concept_type<SubGeometry>::type
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
BOOST_CONCEPT_USAGE(GeometryType)
{
Geometry* dg = nullptr;
SubGeometry* sg = nullptr;
*dg = std::move(*sg);
}
#endif // DOXYGEN_NO_CONCEPT_MEMBERS
};
template <typename Geometry, typename SubGeometry>
struct GeometryType<Geometry const, SubGeometry, dynamic_geometry_tag, false>
: concepts::concept_type<SubGeometry const>::type
{};
} // namespace detail
template <typename Geometry>
struct DynamicGeometry
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
using sequence_t = typename traits::geometry_types<Geometry>::type;
BOOST_CONCEPT_ASSERT((detail::GeometryTypes<Geometry, sequence_t>));
BOOST_CONCEPT_USAGE(DynamicGeometry)
{
Geometry* dg = nullptr;
traits::visit<Geometry>::apply([](auto &&) {}, *dg);
}
#endif // DOXYGEN_NO_CONCEPT_MEMBERS
};
template <typename Geometry>
struct ConstDynamicGeometry
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
using sequence_t = typename traits::geometry_types<Geometry>::type;
BOOST_CONCEPT_ASSERT((detail::GeometryTypes<Geometry const, sequence_t>));
BOOST_CONCEPT_USAGE(ConstDynamicGeometry)
{
Geometry const* dg = nullptr;
traits::visit<Geometry>::apply([](auto &&) {}, *dg);
}
#endif // DOXYGEN_NO_CONCEPT_MEMBERS
};
template <typename Geometry>
struct concept_type<Geometry, dynamic_geometry_tag>
{
using type = DynamicGeometry<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, dynamic_geometry_tag>
{
using type = ConstDynamicGeometry<Geometry>;
};
}}} // namespace boost::geometry::concepts
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_DYNAMIC_GEOMETRY_CONCEPT_HPP

View File

@@ -0,0 +1,157 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_GEOMETRY_COLLECTION_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_GEOMETRY_COLLECTION_CONCEPT_HPP
#include <utility>
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/visit.hpp>
#include <boost/geometry/geometries/concepts/box_concept.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
#include <boost/geometry/geometries/concepts/segment_concept.hpp>
#include <boost/geometry/util/sequence.hpp>
#include <boost/geometry/util/type_traits.hpp>
namespace boost { namespace geometry { namespace concepts
{
namespace detail
{
template
<
typename Geometry,
typename SubGeometry,
typename Tag = typename tag<Geometry>::type,
bool IsSubDynamicOrCollection = util::is_dynamic_geometry<SubGeometry>::value
|| util::is_geometry_collection<SubGeometry>::value
>
struct GeometryType;
// Prevent recursive concept checking
template <typename Geometry, typename SubGeometry, typename Tag>
struct GeometryType<Geometry, SubGeometry, Tag, true> {};
template <typename Geometry, typename SubGeometry, typename Tag>
struct GeometryType<Geometry const, SubGeometry, Tag, true> {};
template <typename Geometry, typename SubGeometry>
struct GeometryType<Geometry, SubGeometry, geometry_collection_tag, false>
: concepts::concept_type<SubGeometry>::type
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
BOOST_CONCEPT_USAGE(GeometryType)
{
Geometry* gc = nullptr;
SubGeometry* sg = nullptr;
traits::emplace_back<Geometry>::apply(*gc, std::move(*sg));
}
#endif // DOXYGEN_NO_CONCEPT_MEMBERS
};
template <typename Geometry, typename SubGeometry>
struct GeometryType<Geometry const, SubGeometry, geometry_collection_tag, false>
: concepts::concept_type<SubGeometry const>::type
{};
template <typename Geometry, typename ...SubGeometries>
struct GeometryTypesPack {};
template <typename Geometry, typename SubGeometry, typename ...SubGeometries>
struct GeometryTypesPack<Geometry, SubGeometry, SubGeometries...>
: GeometryTypesPack<Geometry, SubGeometries...>
, GeometryType<Geometry, SubGeometry>
{};
template <typename Geometry, typename SubGeometriesSequence>
struct GeometryTypes;
template <typename Geometry, typename ...SubGeometries>
struct GeometryTypes<Geometry, util::type_sequence<SubGeometries...>>
: GeometryTypesPack<Geometry, SubGeometries...>
{};
} // namespace detail
template <typename Geometry>
struct GeometryCollection
: boost::ForwardRangeConcept<Geometry>
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
using sequence_t = typename traits::geometry_types<Geometry>::type;
BOOST_CONCEPT_ASSERT( (detail::GeometryTypes<Geometry, sequence_t>) );
BOOST_CONCEPT_USAGE(GeometryCollection)
{
Geometry* gc = nullptr;
traits::clear<Geometry>::apply(*gc);
traits::iter_visit<Geometry>::apply([](auto &&) {}, boost::begin(*gc));
}
#endif // DOXYGEN_NO_CONCEPT_MEMBERS
};
template <typename Geometry>
struct ConstGeometryCollection
: boost::ForwardRangeConcept<Geometry>
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
using sequence_t = typename traits::geometry_types<Geometry>::type;
BOOST_CONCEPT_ASSERT( (detail::GeometryTypes<Geometry const, sequence_t>) );
BOOST_CONCEPT_USAGE(ConstGeometryCollection)
{
Geometry const* gc = nullptr;
traits::iter_visit<Geometry>::apply([](auto &&) {}, boost::begin(*gc));
}
#endif // DOXYGEN_NO_CONCEPT_MEMBERS
};
template <typename Geometry>
struct concept_type<Geometry, geometry_collection_tag>
{
using type = GeometryCollection<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, geometry_collection_tag>
{
using type = ConstGeometryCollection<Geometry>;
};
}}} // namespace boost::geometry::concepts
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_GEOMETRY_COLLECTION_CONCEPT_HPP

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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.
@@ -18,12 +22,12 @@
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
@@ -31,45 +35,6 @@
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief Linestring concept
\ingroup concepts
\par Formal definition:
The linestring concept is defined as following:
- there must be a specialization of traits::tag defining linestring_tag as type
- it must behave like a Boost.Range
- it must implement a std::back_insert_iterator
- either by implementing push_back
- or by specializing std::back_insert_iterator
\note to fulfill the concepts, no traits class has to be specialized to
define the point type.
\par Example:
A custom linestring, defining the necessary specializations to fulfill to the concept.
Suppose that the following linestring is defined:
\dontinclude doxygen_5.cpp
\skip custom_linestring1
\until };
It can then be adapted to the concept as following:
\dontinclude doxygen_5.cpp
\skip adapt custom_linestring1
\until }}
\note
- There is also the registration macro BOOST_GEOMETRY_REGISTER_LINESTRING
- For registration of std::vector<P> (and deque, and list) it is enough to
include the header-file geometries/adapted/std_as_linestring.hpp. That registers
a vector as a linestring (so it cannot be registered as a linear ring then,
in the same source code).
*/
template <typename Geometry>
class Linestring
{
@@ -119,6 +84,20 @@ public :
#endif
};
template <typename Geometry>
struct concept_type<Geometry, linestring_tag>
{
using type = Linestring<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, linestring_tag>
{
using type = ConstLinestring<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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.
@@ -18,27 +22,15 @@
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief multi-linestring concept
\ingroup concepts
\par Formal definition:
The multi linestring concept is defined as following:
- there must be a specialization of traits::tag defining multi_linestring_tag as
type
- it must behave like a Boost.Range
- its range value must fulfil the Linestring concept
*/
template <typename Geometry>
class MultiLinestring
{
@@ -57,7 +49,7 @@ public :
traits::clear<Geometry>::apply(*mls);
traits::resize<Geometry>::apply(*mls, 0);
linestring_type* ls = 0;
traits::push_back<Geometry>::apply(*mls, *ls);
traits::push_back<Geometry>::apply(*mls, std::move(*ls));
}
#endif
};
@@ -85,6 +77,20 @@ public :
#endif
};
template <typename Geometry>
struct concept_type<Geometry, multi_linestring_tag>
{
using type = MultiLinestring<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, multi_linestring_tag>
{
using type = ConstMultiLinestring<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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.
@@ -18,27 +22,17 @@
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief MultiPoint concept
\ingroup concepts
\par Formal definition:
The multi point concept is defined as following:
- there must be a specialization of traits::tag defining multi_point_tag as type
- it must behave like a Boost.Range
- its range value must fulfil the Point concept
*/
template <typename Geometry>
class MultiPoint
{
@@ -85,6 +79,20 @@ public :
#endif
};
template <typename Geometry>
struct concept_type<Geometry, multi_point_tag>
{
using type = MultiPoint<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, multi_point_tag>
{
using type = ConstMultiPoint<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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.
@@ -18,26 +22,15 @@
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief multi-polygon concept
\ingroup concepts
\par Formal definition:
The multi polygon concept is defined as following:
- there must be a specialization of traits::tag defining multi_polygon_tag
as type
- it must behave like a Boost.Range
- its range value must fulfil the Polygon concept
*/
template <typename Geometry>
class MultiPolygon
{
@@ -55,8 +48,9 @@ public :
Geometry* mp = 0;
traits::clear<Geometry>::apply(*mp);
traits::resize<Geometry>::apply(*mp, 0);
// The concept should support the second version of push_back, using &&
polygon_type* poly = 0;
traits::push_back<Geometry>::apply(*mp, *poly);
traits::push_back<Geometry>::apply(*mp, std::move(*poly));
}
#endif
};
@@ -85,6 +79,19 @@ public :
};
template <typename Geometry>
struct concept_type<Geometry, multi_polygon_tag>
{
using type = MultiPolygon<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, multi_polygon_tag>
{
using type = ConstMultiPolygon<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,10 +4,11 @@
// Copyright (c) 2008-2014 Barend Gehrels, Amsterdam, the Netherlands.
// 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.
// This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// 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.
@@ -28,68 +29,12 @@
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_system.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief Point concept.
\ingroup concepts
\par Formal definition:
The point concept is defined as following:
- there must be a specialization of traits::tag defining point_tag as type
- there must be a specialization of traits::coordinate_type defining the type
of its coordinates
- there must be a specialization of traits::coordinate_system defining its
coordinate system (cartesian, spherical, etc)
- there must be a specialization of traits::dimension defining its number
of dimensions (2, 3, ...) (derive it conveniently
from boost::mpl::int_&lt;X&gt; for X-D)
- there must be a specialization of traits::access, per dimension,
with two functions:
- \b get to get a coordinate value
- \b set to set a coordinate value (this one is not checked for ConstPoint)
- for non-Cartesian coordinate systems, the coordinate system's units
must either be boost::geometry::degree or boost::geometry::radian
\par Example:
A legacy point, defining the necessary specializations to fulfil to the concept.
Suppose that the following point is defined:
\dontinclude doxygen_5.cpp
\skip legacy_point1
\until };
It can then be adapted to the concept as following:
\dontinclude doxygen_5.cpp
\skip adapt legacy_point1
\until }}
Note that it is done like above to show the system. Users will normally use the registration macro.
\par Example:
A read-only legacy point, using a macro to fulfil to the ConstPoint concept.
It cannot be modified by the library but can be used in all algorithms where
points are not modified.
The point looks like the following:
\dontinclude doxygen_5.cpp
\skip legacy_point2
\until };
It uses the macro as following:
\dontinclude doxygen_5.cpp
\skip adapt legacy_point2
\until end adaptation
*/
template <typename Geometry>
class Point
{
@@ -187,6 +132,20 @@ public:
#endif
};
template <typename Geometry>
struct concept_type<Geometry, point_tag>
{
using type = Point<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, point_tag>
{
using type = ConstPoint<Geometry>;
};
}}} // namespace boost::geometry::concepts
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021, 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.
@@ -14,6 +18,8 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
#include <type_traits>
#include <boost/concept_check.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/range/concepts.hpp>
@@ -24,6 +30,7 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
@@ -39,7 +46,7 @@ template <typename PolygonType>
class Polygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::remove_const<PolygonType>::type polygon_type;
typedef typename std::remove_const<PolygonType>::type polygon_type;
typedef typename traits::ring_const_type<polygon_type>::type ring_const_type;
typedef typename traits::ring_mutable_type<polygon_type>::type ring_mutable_type;
@@ -90,7 +97,7 @@ class ConstPolygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::remove_const<PolygonType>::type const_polygon_type;
typedef typename std::remove_const<PolygonType>::type const_polygon_type;
typedef typename traits::ring_const_type<const_polygon_type>::type ring_const_type;
typedef typename traits::interior_const_type<const_polygon_type>::type interior_const_type;
@@ -125,6 +132,20 @@ public:
#endif
};
template <typename Geometry>
struct concept_type<Geometry, polygon_tag>
{
using type = Polygon<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, polygon_tag>
{
using type = ConstPolygon<Geometry>;
};
}}} // namespace boost::geometry::concepts
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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.
@@ -18,34 +22,18 @@
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief ring concept
\ingroup concepts
\par Formal definition:
The ring concept is defined as following:
- there must be a specialization of traits::tag defining ring_tag as type
- it must behave like a Boost.Range
- there can optionally be a specialization of traits::point_order defining the
order or orientation of its points, clockwise or counterclockwise.
- it must implement a std::back_insert_iterator
(This is the same as the for the concept Linestring, and described there)
\note to fulfill the concepts, no traits class has to be specialized to
define the point type.
*/
template <typename Geometry>
class Ring
{
@@ -93,6 +81,20 @@ public :
#endif
};
template <typename Geometry>
struct concept_type<Geometry, ring_tag>
{
using type = Ring<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, ring_tag>
{
using type = ConstRing<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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.
@@ -14,37 +18,20 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/geometries/concepts/concept_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
namespace boost { namespace geometry { namespace concepts
{
/*!
\brief Segment concept.
\ingroup concepts
\details Formal definition:
The segment concept is defined as following:
- there must be a specialization of traits::tag defining segment_tag as type
- there must be a specialization of traits::point_type to define the
underlying point type (even if it does not consist of points, it should define
this type, to indicate the points it can work with)
- there must be a specialization of traits::indexed_access, per index
and per dimension, with two functions:
- get to get a coordinate value
- set to set a coordinate value (this one is not checked for ConstSegment)
\note The segment concept is similar to the box concept, defining another tag.
However, the box concept assumes the index as min_corner, max_corner, while
for the segment concept there is no assumption.
*/
template <typename Geometry>
class Segment
{
@@ -129,6 +116,19 @@ public :
};
template <typename Geometry>
struct concept_type<Geometry, segment_tag>
{
using type = Segment<Geometry>;
};
template <typename Geometry>
struct concept_type<Geometry const, segment_tag>
{
using type = ConstSegment<Geometry>;
};
}}} // namespace boost::geometry::concepts

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021, 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.
@@ -14,15 +18,16 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_HPP
#define BOOST_GEOMETRY_GEOMETRIES_HPP
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/geometry_collection.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/point_xyz.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/segment.hpp>

View File

@@ -0,0 +1,74 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_GEOMETRIES_GEOMETRY_COLLECTION_HPP
#define BOOST_GEOMETRY_GEOMETRIES_GEOMETRY_COLLECTION_HPP
#include <vector>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
namespace model
{
/*!
\brief Basic geometry_collection class representing a container of DynamicGeometries.
\ingroup geometries
\tparam DynamicGeometry Type adapted to DynamicGeometry Concept.
\tparam Container \tparam_container
\tparam Allocator \tparam_allocator
*/
template
<
typename DynamicGeometry,
template <typename, typename> class Container = std::vector,
template <typename> class Allocator = std::allocator
>
class geometry_collection
: public Container<DynamicGeometry, Allocator<DynamicGeometry>>
{
typedef Container<DynamicGeometry, Allocator<DynamicGeometry>> base_type;
public:
geometry_collection() = default;
geometry_collection(std::initializer_list<DynamicGeometry> l)
: base_type(l.begin(), l.end())
{}
};
} // namespace model
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template
<
typename DynamicGeometry,
template <typename, typename> class Container,
template <typename> class Allocator
>
struct tag<model::geometry_collection<DynamicGeometry, Container, Allocator>>
{
using type = geometry_collection_tag;
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_GEOMETRY_COLLECTION_HPP

View File

@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2015-2017, Oracle and/or its affiliates.
// Copyright (c) 2015-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -11,17 +11,20 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
#define BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
#include <boost/mpl/assert.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
@@ -70,23 +73,50 @@ struct helper_geometry : not_implemented<Geometry>
template <typename Point, typename NewCoordinateType, typename NewUnits>
struct helper_geometry<Point, NewCoordinateType, NewUnits, point_tag>
{
typedef typename detail::helper_geometries::helper_point
using type = typename detail::helper_geometries::helper_point
<
Point, NewCoordinateType, NewUnits
>::type type;
>::type;
};
template <typename Box, typename NewCoordinateType, typename NewUnits>
struct helper_geometry<Box, NewCoordinateType, NewUnits, box_tag>
{
typedef model::box
using type = model::box
<
typename helper_geometry
<
typename point_type<Box>::type, NewCoordinateType, NewUnits
>::type
> type;
>;
};
template <typename Linestring, typename NewCoordinateType, typename NewUnits>
struct helper_geometry<Linestring, NewCoordinateType, NewUnits, linestring_tag>
{
using type = model::linestring
<
typename helper_geometry
<
typename point_type<Linestring>::type, NewCoordinateType, NewUnits
>::type
>;
};
template <typename Ring, typename NewCoordinateType, typename NewUnits>
struct helper_geometry<Ring, NewCoordinateType, NewUnits, ring_tag>
{
using type = model::ring
<
typename helper_geometry
<
typename point_type<Ring>::type, NewCoordinateType, NewUnits
>::type,
point_order<Ring>::value != counterclockwise,
closure<Ring>::value != open
>;
};
@@ -104,10 +134,10 @@ template
>
struct helper_geometry
{
typedef typename detail_dispatch::helper_geometry
using type = typename detail_dispatch::helper_geometry
<
Geometry, NewCoordinateType, NewUnits
>::type type;
>::type;
};

View File

@@ -0,0 +1,52 @@
// Boost.Geometry
// Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_GEOMETRIES_INFINITE_LINE_HPP
#define BOOST_GEOMETRY_GEOMETRIES_INFINITE_LINE_HPP
namespace boost { namespace geometry
{
namespace model
{
//--------------------------------------------------------------------------
// Structure containing an infinite line.
// It is written using "General Form", a*x + b*y + c == 0
// Might be conceptized later. Therefore operations are implemented outside
// the structure itself.
template <typename Type = double>
struct infinite_line
{
using type = Type;
infinite_line()
: a(0)
, b(0)
, c(0)
, normalized(false)
{}
// Horizontal: a == 0, for example y-3=0, y==3
// Vertical: b == 0, for example x-2=0, x==2
// Through origin: c == 0
Type a;
Type b;
Type c;
bool normalized;
};
} // namespace model
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_INFINITE_LINE_HPP

View File

@@ -5,6 +5,9 @@
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2020, 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.
@@ -19,17 +22,14 @@
#include <vector>
#include <boost/concept/assert.hpp>
#include <boost/range.hpp>
#include <boost/config.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
namespace boost { namespace geometry
{
@@ -75,8 +75,6 @@ public :
: base_type(begin, end)
{}
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
/// \constructor_initializer_list{linestring}
inline linestring(std::initializer_list<Point> l)
: base_type(l.begin(), l.end())
@@ -94,8 +92,6 @@ public :
// return *this;
// }
//#endif
#endif
};
} // namespace model

View File

@@ -24,9 +24,8 @@
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
namespace boost { namespace geometry
{
@@ -57,8 +56,6 @@ class multi_linestring : public Container<LineString, Allocator<LineString> >
{
BOOST_CONCEPT_ASSERT( (concepts::Linestring<LineString>) );
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
// default constructor and base_type definitions are required only
// if the constructor taking std::initializer_list is defined
@@ -87,8 +84,6 @@ public:
// return *this;
// }
//#endif
#endif
};

View File

@@ -24,9 +24,8 @@
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
namespace boost { namespace geometry
{
@@ -74,8 +73,6 @@ public :
: base_type(begin, end)
{}
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
/// \constructor_initializer_list{multi_point}
inline multi_point(std::initializer_list<Point> l)
: base_type(l.begin(), l.end())
@@ -94,7 +91,6 @@ public :
// }
//#endif
#endif
};
} // namespace model

View File

@@ -24,9 +24,9 @@
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
namespace boost { namespace geometry
{
@@ -56,8 +56,6 @@ class multi_polygon : public Container<Polygon, Allocator<Polygon> >
{
BOOST_CONCEPT_ASSERT( (concepts::Polygon<Polygon>) );
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
// default constructor and base_type definitions are required only
// if the constructor taking std::initializer_list is defined
@@ -86,8 +84,6 @@ public:
// return *this;
// }
//#endif
#endif
};

View File

@@ -5,10 +5,10 @@
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014, Oracle and/or its affiliates.
// This file was modified by Oracle on 2014-2020.
// Modifications copyright (c) 2014-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// 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.
@@ -21,16 +21,18 @@
#define BOOST_GEOMETRY_GEOMETRIES_POINT_HPP
#include <cstddef>
#include <type_traits>
#include <boost/config.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/int.hpp>
#include <boost/static_assert.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/coordinate_system.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/make.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
#include <algorithm>
@@ -46,41 +48,27 @@ namespace boost { namespace geometry
#pragma warning(disable : 4127)
#endif
namespace detail
{
template <typename Dummy, std::size_t N, std::size_t DimensionCount>
struct is_coordinates_number_leq
{
static const bool value = (N <= DimensionCount);
};
template <typename Dummy, std::size_t N, std::size_t DimensionCount>
struct is_coordinates_number_eq
{
static const bool value = (N == DimensionCount);
};
} // namespace detail
namespace model
{
namespace detail
{
template <std::size_t DimensionCount, std::size_t Index>
struct array_assign
{
template <typename T>
static inline void apply(T values[], T const& value)
{
values[Index] = value;
}
};
// Specialization avoiding assigning element [2] for only 2 dimensions
template <> struct array_assign<2, 2>
{
template <typename T> static inline void apply(T [], T const& ) {}
};
// Specialization avoiding assigning elements for (rarely used) points in 1 dim
template <> struct array_assign<1, 1>
{
template <typename T> static inline void apply(T [], T const& ) {}
};
template <> struct array_assign<1, 2>
{
template <typename T> static inline void apply(T [], T const& ) {}
};
}
/*!
\brief Basic point class, having coordinates defined in a neutral way
\details Defines a neutral point class, fulfilling the Point Concept.
@@ -107,9 +95,7 @@ template
>
class point
{
BOOST_MPL_ASSERT_MSG((DimensionCount >= 1),
DIMENSION_GREATER_THAN_ZERO_EXPECTED,
(boost::mpl::int_<DimensionCount>));
BOOST_STATIC_ASSERT(DimensionCount > 0);
// The following enum is used to fully instantiate the
// CoordinateSystem class and check the correctness of the units
@@ -118,14 +104,18 @@ class point
public:
// TODO: constexpr requires LiteralType and until C++20
// it has to have trivial destructor which makes access
// debugging impossible with constexpr.
#if !defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
/// \constructor_default_no_init
point() = default;
constexpr point()
// Workaround for VS2015
#if defined(_MSC_VER) && (_MSC_VER < 1910)
: m_values{} {}
#else
/// \constructor_default_no_init
inline point()
{}
= default;
#endif
#else // defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
point()
@@ -141,42 +131,56 @@ public:
#endif
/// @brief Constructor to set one value
explicit inline point(CoordinateType const& v0)
template
<
typename C = CoordinateType,
std::enable_if_t<geometry::detail::is_coordinates_number_leq<C, 1, DimensionCount>::value, int> = 0
>
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
explicit point(CoordinateType const& v0)
: m_values{v0}
{
detail::array_assign<DimensionCount, 0>::apply(m_values, v0);
detail::array_assign<DimensionCount, 1>::apply(m_values, CoordinateType());
detail::array_assign<DimensionCount, 2>::apply(m_values, CoordinateType());
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
m_created = 1;
std::fill_n(m_values_initialized, (std::min)(std::size_t(3), DimensionCount), 1);
std::fill_n(m_values_initialized, DimensionCount, 1);
#endif
}
/// @brief Constructor to set two values
inline point(CoordinateType const& v0, CoordinateType const& v1)
template
<
typename C = CoordinateType,
std::enable_if_t<geometry::detail::is_coordinates_number_leq<C, 2, DimensionCount>::value, int> = 0
>
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
point(CoordinateType const& v0, CoordinateType const& v1)
: m_values{ v0, v1 }
{
detail::array_assign<DimensionCount, 0>::apply(m_values, v0);
detail::array_assign<DimensionCount, 1>::apply(m_values, v1);
detail::array_assign<DimensionCount, 2>::apply(m_values, CoordinateType());
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
m_created = 1;
std::fill_n(m_values_initialized, (std::min)(std::size_t(3), DimensionCount), 1);
std::fill_n(m_values_initialized, DimensionCount, 1);
#endif
}
/// @brief Constructor to set three values
inline point(CoordinateType const& v0, CoordinateType const& v1,
CoordinateType const& v2)
template
<
typename C = CoordinateType,
std::enable_if_t<geometry::detail::is_coordinates_number_leq<C, 3, DimensionCount>::value, int> = 0
>
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
point(CoordinateType const& v0, CoordinateType const& v1, CoordinateType const& v2)
: m_values{ v0, v1, v2 }
{
detail::array_assign<DimensionCount, 0>::apply(m_values, v0);
detail::array_assign<DimensionCount, 1>::apply(m_values, v1);
detail::array_assign<DimensionCount, 2>::apply(m_values, v2);
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
m_created = 1;
std::fill_n(m_values_initialized, (std::min)(std::size_t(3), DimensionCount), 1);
std::fill_n(m_values_initialized, DimensionCount, 1);
#endif
}
@@ -184,7 +188,10 @@ public:
/// @tparam K coordinate to get
/// @return the coordinate
template <std::size_t K>
inline CoordinateType const& get() const
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
constexpr
#endif
CoordinateType const& get() const
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
BOOST_GEOMETRY_ASSERT(m_created == 1);
@@ -198,7 +205,7 @@ public:
/// @tparam K coordinate to set
/// @param value value to set
template <std::size_t K>
inline void set(CoordinateType const& value)
void set(CoordinateType const& value)
{
#if defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
BOOST_GEOMETRY_ASSERT(m_created == 1);
@@ -265,7 +272,7 @@ template
typename CoordinateSystem
>
struct dimension<model::point<CoordinateType, DimensionCount, CoordinateSystem> >
: boost::mpl::int_<DimensionCount>
: std::integral_constant<std::size_t, DimensionCount>
{};
template
@@ -277,13 +284,13 @@ template
>
struct access<model::point<CoordinateType, DimensionCount, CoordinateSystem>, Dimension>
{
static inline CoordinateType get(
static constexpr CoordinateType get(
model::point<CoordinateType, DimensionCount, CoordinateSystem> const& p)
{
return p.template get<Dimension>();
}
static inline void set(
static void set(
model::point<CoordinateType, DimensionCount, CoordinateSystem>& p,
CoordinateType const& value)
{
@@ -291,6 +298,53 @@ struct access<model::point<CoordinateType, DimensionCount, CoordinateSystem>, Di
}
};
template
<
typename CoordinateType,
std::size_t DimensionCount,
typename CoordinateSystem
>
struct make<model::point<CoordinateType, DimensionCount, CoordinateSystem> >
{
typedef model::point<CoordinateType, DimensionCount, CoordinateSystem> point_type;
static const bool is_specialized = true;
template
<
typename C = CoordinateType,
std::enable_if_t<geometry::detail::is_coordinates_number_eq<C, 1, DimensionCount>::value, int> = 0
>
static constexpr point_type apply(CoordinateType const& v0)
{
return point_type(v0);
}
template
<
typename C = CoordinateType,
std::enable_if_t<geometry::detail::is_coordinates_number_eq<C, 2, DimensionCount>::value, int> = 0
>
static constexpr point_type apply(CoordinateType const& v0,
CoordinateType const& v1)
{
return point_type(v0, v1);
}
template
<
typename C = CoordinateType,
std::enable_if_t<geometry::detail::is_coordinates_number_eq<C, 3, DimensionCount>::value, int> = 0
>
static constexpr point_type apply(CoordinateType const& v0,
CoordinateType const& v1,
CoordinateType const& v2)
{
return point_type(v0, v1, v2);
}
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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.
@@ -15,9 +19,7 @@
#define BOOST_GEOMETRY_GEOMETRIES_POINT_XY_HPP
#include <cstddef>
#include <boost/config.hpp>
#include <boost/mpl/int.hpp>
#include <type_traits>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/geometries/point.hpp>
@@ -46,35 +48,28 @@ template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
class point_xy : public model::point<CoordinateType, 2, CoordinateSystem>
{
public:
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
/// \constructor_default_no_init
point_xy() = default;
#else
/// \constructor_default_no_init
inline point_xy()
{}
#endif
constexpr point_xy() = default;
/// Constructor with x/y values
inline point_xy(CoordinateType const& x, CoordinateType const& y)
constexpr point_xy(CoordinateType const& x, CoordinateType const& y)
: model::point<CoordinateType, 2, CoordinateSystem>(x, y)
{}
/// Get x-value
inline CoordinateType const& x() const
constexpr CoordinateType const& x() const
{ return this->template get<0>(); }
/// Get y-value
inline CoordinateType const& y() const
constexpr CoordinateType const& y() const
{ return this->template get<1>(); }
/// Set x-value
inline void x(CoordinateType const& v)
void x(CoordinateType const& v)
{ this->template set<0>(v); }
/// Set y-value
inline void y(CoordinateType const& v)
void y(CoordinateType const& v)
{ this->template set<1>(v); }
};
@@ -107,25 +102,40 @@ struct coordinate_system<model::d2::point_xy<CoordinateType, CoordinateSystem> >
template<typename CoordinateType, typename CoordinateSystem>
struct dimension<model::d2::point_xy<CoordinateType, CoordinateSystem> >
: boost::mpl::int_<2>
: std::integral_constant<std::size_t, 2>
{};
template<typename CoordinateType, typename CoordinateSystem, std::size_t Dimension>
struct access<model::d2::point_xy<CoordinateType, CoordinateSystem>, Dimension >
{
static inline CoordinateType get(
static constexpr CoordinateType get(
model::d2::point_xy<CoordinateType, CoordinateSystem> const& p)
{
return p.template get<Dimension>();
}
static inline void set(model::d2::point_xy<CoordinateType, CoordinateSystem>& p,
static void set(model::d2::point_xy<CoordinateType, CoordinateSystem>& p,
CoordinateType const& value)
{
p.template set<Dimension>(value);
}
};
template<typename CoordinateType, typename CoordinateSystem>
struct make<model::d2::point_xy<CoordinateType, CoordinateSystem> >
{
typedef model::d2::point_xy<CoordinateType, CoordinateSystem> point_type;
static const bool is_specialized = true;
static constexpr point_type apply(CoordinateType const& x,
CoordinateType const& y)
{
return point_type(x, y);
}
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS

View File

@@ -0,0 +1,148 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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_GEOMETRIES_POINT_XYZ_HPP
#define BOOST_GEOMETRY_GEOMETRIES_POINT_XYZ_HPP
#include <cstddef>
#include <type_traits>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/geometries/point.hpp>
namespace boost { namespace geometry
{
namespace model { namespace d3
{
/*!
\brief 3D point in Cartesian coordinate system
\tparam CoordinateType numeric type, for example, double, float, int
\tparam CoordinateSystem coordinate system, defaults to cs::cartesian
\qbk{[include reference/geometries/point_xyz.qbk]}
\qbk{before.synopsis,
[heading Model of]
[link geometry.reference.concepts.concept_point Point Concept]
}
\qbk{[include reference/geometries/point_assign_warning.qbk]}
*/
template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
class point_xyz : public model::point<CoordinateType, 3, CoordinateSystem>
{
public:
/// \constructor_default_no_init
constexpr point_xyz() = default;
/// Constructor with x/y/z values
constexpr point_xyz(CoordinateType const& x, CoordinateType const& y, CoordinateType const& z)
: model::point<CoordinateType, 3, CoordinateSystem>(x, y, z)
{}
/// Get x-value
constexpr CoordinateType const& x() const
{ return this->template get<0>(); }
/// Get y-value
constexpr CoordinateType const& y() const
{ return this->template get<1>(); }
/// Get z-value
constexpr CoordinateType const& z() const
{ return this->template get<2>(); }
/// Set x-value
void x(CoordinateType const& v)
{ this->template set<0>(v); }
/// Set y-value
void y(CoordinateType const& v)
{ this->template set<1>(v); }
/// Set z-value
void z(CoordinateType const& v)
{ this->template set<2>(v); }
};
}} // namespace model::d3
// Adapt the point_xyz to the concept
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template <typename CoordinateType, typename CoordinateSystem>
struct tag<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
{
typedef point_tag type;
};
template<typename CoordinateType, typename CoordinateSystem>
struct coordinate_type<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
{
typedef CoordinateType type;
};
template<typename CoordinateType, typename CoordinateSystem>
struct coordinate_system<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
{
typedef CoordinateSystem type;
};
template<typename CoordinateType, typename CoordinateSystem>
struct dimension<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
: std::integral_constant<std::size_t, 3>
{};
template<typename CoordinateType, typename CoordinateSystem, std::size_t Dimension>
struct access<model::d3::point_xyz<CoordinateType, CoordinateSystem>, Dimension>
{
static constexpr CoordinateType get(
model::d3::point_xyz<CoordinateType, CoordinateSystem> const& p)
{
return p.template get<Dimension>();
}
static void set(model::d3::point_xyz<CoordinateType, CoordinateSystem>& p,
CoordinateType const& value)
{
p.template set<Dimension>(value);
}
};
template<typename CoordinateType, typename CoordinateSystem>
struct make<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
{
typedef model::d3::point_xyz<CoordinateType, CoordinateSystem> point_type;
static const bool is_specialized = true;
static constexpr point_type apply(CoordinateType const& x,
CoordinateType const& y,
CoordinateType const& z)
{
return point_type(x, y, z);
}
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_POINT_XYZ_HPP

View File

@@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates.
// Copyright (c) 2014-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
@@ -11,11 +12,10 @@
#define BOOST_GEOMETRY_GEOMETRIES_POINTING_SEGMENT_HPP
#include <cstddef>
#include <type_traits>
#include <boost/concept/assert.hpp>
#include <boost/core/addressof.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/assert.hpp>
@@ -41,9 +41,9 @@ template <typename ConstOrNonConstPoint>
class pointing_segment
{
BOOST_CONCEPT_ASSERT( (
typename boost::mpl::if_
typename std::conditional
<
boost::is_const<ConstOrNonConstPoint>,
std::is_const<ConstOrNonConstPoint>::value,
concepts::Point<ConstOrNonConstPoint>,
concepts::ConstPoint<ConstOrNonConstPoint>
>

View File

@@ -28,9 +28,9 @@
#include <boost/geometry/geometries/ring.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
namespace boost { namespace geometry
{
@@ -90,8 +90,6 @@ public:
inline ring_type& outer() { return m_outer; }
inline inner_container_type & inners() { return m_inners; }
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
// default constructor definition is required only
// if the constructor taking std::initializer_list is defined
@@ -129,8 +127,6 @@ public:
// }
//#endif
#endif
/// Utility method, clears outer and inner rings
inline void clear()
{

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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.
@@ -14,15 +18,21 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_system.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/cs.hpp>
#include <cstddef>
#include <type_traits>
#ifndef DOXYGEN_NO_SPECIALIZATIONS
// Starting point, specialize basic traits necessary to register a point
#define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, Dim, CoordinateType, CoordinateSystem) \
template<> struct tag<Point> { typedef point_tag type; }; \
template<> struct dimension<Point> : boost::mpl::int_<Dim> {}; \
template<> struct dimension<Point> : std::integral_constant<std::size_t, Dim> {}; \
template<> struct coordinate_type<Point> { typedef CoordinateType type; }; \
template<> struct coordinate_system<Point> { typedef CoordinateSystem type; };

View File

@@ -28,9 +28,8 @@
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
namespace boost { namespace geometry
{
@@ -79,8 +78,6 @@ public :
: base_type(begin, end)
{}
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
/// \constructor_initializer_list{ring}
inline ring(std::initializer_list<Point> l)
: base_type(l.begin(), l.end())
@@ -99,7 +96,6 @@ public :
// }
//#endif
#endif
};
} // namespace model

View File

@@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, 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.
@@ -15,10 +19,16 @@
#define BOOST_GEOMETRY_GEOMETRIES_SEGMENT_HPP
#include <cstddef>
#include <utility>
#include <type_traits>
#include <boost/concept/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/make.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
@@ -49,23 +59,15 @@ class segment : public std::pair<Point, Point>
public :
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
/// \constructor_default_no_init
segment() = default;
#else
/// \constructor_default_no_init
inline segment()
{}
#endif
constexpr segment() = default;
/*!
\brief Constructor taking the first and the second point
*/
inline segment(Point const& p1, Point const& p2)
{
this->first = p1;
this->second = p2;
}
constexpr segment(Point const& p1, Point const& p2)
: std::pair<Point, Point>(p1, p2)
{}
};
@@ -86,9 +88,9 @@ template<typename ConstOrNonConstPoint>
class referring_segment
{
BOOST_CONCEPT_ASSERT( (
typename boost::mpl::if_
typename std::conditional
<
boost::is_const<ConstOrNonConstPoint>,
std::is_const<ConstOrNonConstPoint>::value,
concepts::Point<ConstOrNonConstPoint>,
concepts::ConstPoint<ConstOrNonConstPoint>
>
@@ -137,12 +139,12 @@ struct indexed_access<model::segment<Point>, 0, Dimension>
typedef model::segment<Point> segment_type;
typedef typename geometry::coordinate_type<segment_type>::type coordinate_type;
static inline coordinate_type get(segment_type const& s)
static constexpr coordinate_type get(segment_type const& s)
{
return geometry::get<Dimension>(s.first);
}
static inline void set(segment_type& s, coordinate_type const& value)
static void set(segment_type& s, coordinate_type const& value)
{
geometry::set<Dimension>(s.first, value);
}
@@ -155,18 +157,33 @@ struct indexed_access<model::segment<Point>, 1, Dimension>
typedef model::segment<Point> segment_type;
typedef typename geometry::coordinate_type<segment_type>::type coordinate_type;
static inline coordinate_type get(segment_type const& s)
static constexpr coordinate_type get(segment_type const& s)
{
return geometry::get<Dimension>(s.second);
}
static inline void set(segment_type& s, coordinate_type const& value)
static void set(segment_type& s, coordinate_type const& value)
{
geometry::set<Dimension>(s.second, value);
}
};
template <typename Point>
struct make<model::segment<Point> >
{
typedef model::segment<Point> segment_type;
static const bool is_specialized = true;
static constexpr segment_type apply(Point const& p1, Point const& p2)
{
return segment_type(p1, p2);
}
};
template <typename ConstOrNonConstPoint>
struct tag<model::referring_segment<ConstOrNonConstPoint> >
{

View File

@@ -1,46 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2018.
// Modifications copyright (c) 2018, 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_GEOMETRIES_VARIANT_GEOMETRY_HPP
#define BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP
#include <boost/mpl/front.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/core/point_type.hpp>
namespace boost { namespace geometry {
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct point_type<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
: point_type<
typename boost::mpl::front<
typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
>::type
>
{};
} // namespace geometry
} // namespace boost
#endif // BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP