mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-29 19:42:10 +00:00
Add util/type_traits, polylinear_tag, simplify types in umbrella strategies.
This commit is contained in:
@@ -4,9 +4,8 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2014, 2018.
|
||||
// Modifications copyright (c) 2014-2018 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 Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
@@ -69,6 +68,9 @@ struct pointlike_tag {};
|
||||
/// For linear types (linestring, multi-linestring, segment)
|
||||
struct linear_tag {};
|
||||
|
||||
// Subset of linear types (polygon, multi_polygon)
|
||||
struct polylinear_tag : linear_tag {};
|
||||
|
||||
/// For areal types (polygon, multi_polygon, box, ring)
|
||||
struct areal_tag {};
|
||||
|
||||
@@ -89,7 +91,7 @@ struct geometry_not_recognized_tag {};
|
||||
struct point_tag : single_tag, pointlike_tag {};
|
||||
|
||||
/// OGC Linestring identifying tag
|
||||
struct linestring_tag : single_tag, linear_tag {};
|
||||
struct linestring_tag : single_tag, polylinear_tag {};
|
||||
|
||||
/// OGC Polygon identifying tag
|
||||
struct polygon_tag : single_tag, polygonal_tag {};
|
||||
@@ -108,7 +110,7 @@ struct segment_tag : single_tag, linear_tag {};
|
||||
struct multi_point_tag : multi_tag, pointlike_tag {};
|
||||
|
||||
/// OGC Multi linestring identifying tag
|
||||
struct multi_linestring_tag : multi_tag, linear_tag {};
|
||||
struct multi_linestring_tag : multi_tag, polylinear_tag {};
|
||||
|
||||
/// OGC Multi polygon identifying tag
|
||||
struct multi_polygon_tag : multi_tag, polygonal_tag {};
|
||||
|
||||
@@ -39,35 +39,35 @@ struct cartesian : strategies::detail::cartesian_base
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_point();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_multi_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_multi_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_multipoint();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_box();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_segment<CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_non_trivial_linear_or_polygonal<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_polysegmental_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian<CalculationType>();
|
||||
}
|
||||
@@ -76,21 +76,21 @@ struct cartesian : strategies::detail::cartesian_base
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_point();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_segment();
|
||||
}
|
||||
|
||||
@@ -11,13 +11,12 @@
|
||||
#define BOOST_GEOMETRY_STRATEGIES_DETAIL_HPP
|
||||
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
#include <boost/geometry/strategies/geographic/parameters.hpp>
|
||||
#include <boost/geometry/strategies/spherical/get_radius.hpp>
|
||||
#include <boost/geometry/srs/sphere.hpp>
|
||||
#include <boost/geometry/srs/spheroid.hpp>
|
||||
#include <boost/geometry/util/type_traits.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -120,81 +119,6 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_pointlike
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_base_of<pointlike_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_linear
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_base_of<linear_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_polygonal
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_base_of<polygonal_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_non_trivial_linear_or_polygonal
|
||||
: std::enable_if
|
||||
<
|
||||
((std::is_base_of<linear_tag, typename tag<Geometry>::type>::value
|
||||
|| std::is_base_of<polygonal_tag, typename tag<Geometry>::type>::value)
|
||||
&& (!std::is_same<segment_tag, typename tag<Geometry>::type>::value)),
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_point
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_same<point_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_multi_point
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_same<multi_point_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_box
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_same<box_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_segment
|
||||
: std::enable_if
|
||||
<
|
||||
std::is_same<segment_tag, typename tag<Geometry>::type>::value,
|
||||
T
|
||||
>
|
||||
{};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
@@ -38,42 +38,42 @@ struct cartesian : strategies::detail::cartesian_base
|
||||
{
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_point();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_multi_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_multi_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_multipoint();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_box();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian_segment<CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_non_trivial_linear_or_polygonal<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_polysegmental_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::cartesian<CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_point();
|
||||
}
|
||||
@@ -81,14 +81,14 @@ struct cartesian : strategies::detail::cartesian_base
|
||||
// TEMP
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_segment();
|
||||
}
|
||||
|
||||
@@ -48,28 +48,28 @@ public:
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_multi_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_multi_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_multipoint();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
auto envelope(Geometry const&, Box const&,
|
||||
typename detail::enable_if_segment<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::envelope::geographic_segment
|
||||
<
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
auto envelope(Geometry const&, Box const&,
|
||||
typename detail::enable_if_non_trivial_linear_or_polygonal<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_polysegmental_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::envelope::geographic
|
||||
<
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_point();
|
||||
}
|
||||
@@ -97,14 +97,14 @@ public:
|
||||
// TEMP
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
auto expand(Box const&, Geometry const&,
|
||||
typename detail::enable_if_segment<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::expand::geographic_segment
|
||||
<
|
||||
|
||||
@@ -44,42 +44,42 @@ class spherical : strategies::detail::spherical_base<void>
|
||||
public:
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_multi_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_multi_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_multipoint();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_segment<CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_non_trivial_linear_or_polygonal<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_polysegmental_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical<CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_point();
|
||||
}
|
||||
@@ -87,14 +87,14 @@ public:
|
||||
// TEMP
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_segment<CalculationType>();
|
||||
}
|
||||
|
||||
@@ -34,21 +34,21 @@ struct cartesian : strategies::detail::cartesian_base
|
||||
{
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_point();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::cartesian_segment();
|
||||
}
|
||||
|
||||
@@ -46,21 +46,21 @@ public:
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
auto expand(Box const&, Geometry const&,
|
||||
typename detail::enable_if_segment<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::expand::geographic_segment
|
||||
<
|
||||
|
||||
@@ -39,21 +39,21 @@ class spherical : strategies::detail::spherical_base<void>
|
||||
public:
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_segment<CalculationType>();
|
||||
}
|
||||
|
||||
@@ -59,28 +59,28 @@ public:
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_multi_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_multi_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_multipoint();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
auto envelope(Geometry const&, Box const&,
|
||||
typename detail::enable_if_segment<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::envelope::geographic_segment
|
||||
<
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
auto envelope(Geometry const&, Box const&,
|
||||
typename detail::enable_if_non_trivial_linear_or_polygonal<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_polysegmental_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::envelope::geographic
|
||||
<
|
||||
@@ -102,21 +102,21 @@ public:
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
auto expand(Box const&, Geometry const&,
|
||||
typename detail::enable_if_segment<Geometry>::type * = nullptr) const
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr) const
|
||||
{
|
||||
return strategy::expand::geographic_segment
|
||||
<
|
||||
|
||||
@@ -58,35 +58,35 @@ public:
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_multi_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_multi_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_multipoint();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical_segment<CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
static auto envelope(Geometry const&, Box const&,
|
||||
typename strategies::detail::enable_if_non_trivial_linear_or_polygonal<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_polysegmental_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::envelope::spherical<CalculationType>();
|
||||
}
|
||||
@@ -95,21 +95,21 @@ public:
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_point<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_point_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_point();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_box<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_box_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_box();
|
||||
}
|
||||
|
||||
template <typename Box, typename Geometry>
|
||||
static auto expand(Box const&, Geometry const&,
|
||||
typename strategies::detail::enable_if_segment<Geometry>::type * = nullptr)
|
||||
typename geometry::detail::enable_if_segment_t<Geometry> * = nullptr)
|
||||
{
|
||||
return strategy::expand::spherical_segment<CalculationType>();
|
||||
}
|
||||
|
||||
202
include/boost/geometry/util/type_traits.hpp
Normal file
202
include/boost/geometry/util/type_traits.hpp
Normal file
@@ -0,0 +1,202 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2020, 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_UTIL_TYPE_TRAITS_HPP
|
||||
#define BOOST_GEOMETRY_UTIL_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_point
|
||||
: std::is_same<point_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_multi_point
|
||||
: std::is_same<multi_point_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_pointlike
|
||||
: std::is_base_of<pointlike_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_segment
|
||||
: std::is_same<segment_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_linestring
|
||||
: std::is_same<linestring_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_multi_linestring
|
||||
: std::is_same<multi_linestring_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_polylinear
|
||||
: std::is_base_of<polylinear_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_linear
|
||||
: std::is_base_of<linear_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_box
|
||||
: std::is_same<box_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_ring
|
||||
: std::is_same<ring_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_polygon
|
||||
: std::is_same<polygon_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_multi_polygon
|
||||
: std::is_same<multi_polygon_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_polygonal
|
||||
: std::is_base_of<polygonal_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_areal
|
||||
: std::is_base_of<areal_tag, typename tag<Geometry>::type>
|
||||
{};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
bool Enable = (is_polylinear<Geometry>::value || is_polygonal<Geometry>::value)
|
||||
>
|
||||
struct is_polysegmental
|
||||
: std::true_type
|
||||
{};
|
||||
template <typename Geometry>
|
||||
struct is_polysegmental<Geometry, false>
|
||||
: std::false_type
|
||||
{};
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_point
|
||||
: std::enable_if<is_point<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_point_t = typename enable_if_point<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_multi_point
|
||||
: std::enable_if<is_multi_point<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_multi_point_t = typename enable_if_multi_point<Geometry, T>::type;
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_pointlike
|
||||
: std::enable_if<is_pointlike<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_pointlike_t = typename enable_if_pointlike<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_segment
|
||||
: std::enable_if<is_segment<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_segment_t = typename enable_if_segment<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_polylinear
|
||||
: std::enable_if<is_polylinear<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_polylinear_t = typename enable_if_polylinear<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_linear
|
||||
: std::enable_if<is_linear<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_linear_t = typename enable_if_linear<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_box
|
||||
: std::enable_if<is_box<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_box_t = typename enable_if_box<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_polygonal
|
||||
: std::enable_if<is_polygonal<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_polygonal_t = typename enable_if_polygonal<Geometry, T>::type;
|
||||
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
struct enable_if_polysegmental
|
||||
: std::enable_if<is_polysegmental<Geometry>::value, T>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename T = void>
|
||||
using enable_if_polysegmental_t = typename enable_if_polysegmental<Geometry, T>::type;
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_STRATEGIES_DETAIL_HPP
|
||||
Reference in New Issue
Block a user