summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/expand/interface.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/expand/interface.hpp')
-rw-r--r--boost/geometry/algorithms/detail/expand/interface.hpp85
1 files changed, 21 insertions, 64 deletions
diff --git a/boost/geometry/algorithms/detail/expand/interface.hpp b/boost/geometry/algorithms/detail/expand/interface.hpp
index 442a4e011f..6552c266e4 100644
--- a/boost/geometry/algorithms/detail/expand/interface.hpp
+++ b/boost/geometry/algorithms/detail/expand/interface.hpp
@@ -22,22 +22,23 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP
-#include <boost/variant/apply_visitor.hpp>
-#include <boost/variant/static_visitor.hpp>
-#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/algorithms/dispatch/expand.hpp>
#include <boost/geometry/core/coordinate_system.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
+#include <boost/geometry/core/visit.hpp>
+#include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/expand/services.hpp>
+#include <boost/geometry/util/type_traits_std.hpp>
+
namespace boost { namespace geometry
{
@@ -97,10 +98,10 @@ struct expand<default_strategy, false>
} //namespace resolve_strategy
-namespace resolve_variant
+namespace resolve_dynamic
{
-
-template <typename Geometry>
+
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
struct expand
{
template <typename Box, typename Strategy>
@@ -111,72 +112,28 @@ struct expand
concepts::check<Box>();
concepts::check<Geometry const>();
concepts::check_concepts_and_equal_dimensions<Box, Geometry const>();
-
+
resolve_strategy::expand<Strategy>::apply(box, geometry, strategy);
}
};
-template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-struct expand<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+template <typename Geometry>
+struct expand<Geometry, dynamic_geometry_tag>
{
- template <typename Box, typename Strategy>
- struct visitor: boost::static_visitor<void>
- {
- Box& m_box;
- Strategy const& m_strategy;
-
- visitor(Box& box, Strategy const& strategy)
- : m_box(box)
- , m_strategy(strategy)
- {}
-
- template <typename Geometry>
- void operator()(Geometry const& geometry) const
- {
- return expand<Geometry>::apply(m_box, geometry, m_strategy);
- }
- };
-
template <class Box, typename Strategy>
- static inline void
- apply(Box& box,
- boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry,
- Strategy const& strategy)
+ static inline void apply(Box& box,
+ Geometry const& geometry,
+ Strategy const& strategy)
{
- return boost::apply_visitor(visitor<Box, Strategy>(box, strategy),
- geometry);
+ traits::visit<Geometry>::apply([&](auto const& g)
+ {
+ expand<util::remove_cref_t<decltype(g)>>::apply(box, g, strategy);
+ }, geometry);
}
};
-
-} // namespace resolve_variant
-
-
-/***
-*!
-\brief Expands a box using the extend (envelope) of another geometry (box, point)
-\ingroup expand
-\tparam Box type of the box
-\tparam Geometry of second geometry, to be expanded with the box
-\param box box to expand another geometry with, might be changed
-\param geometry other geometry
-\param strategy_less
-\param strategy_greater
-\note Strategy is currently ignored
- *
-template
-<
- typename Box, typename Geometry,
- typename StrategyLess, typename StrategyGreater
->
-inline void expand(Box& box, Geometry const& geometry,
- StrategyLess const& strategy_less,
- StrategyGreater const& strategy_greater)
-{
- concepts::check_concepts_and_equal_dimensions<Box, Geometry const>();
- dispatch::expand<Box, Geometry>::apply(box, geometry);
-}
-***/
+} // namespace resolve_dynamic
+
/*!
\brief Expands (with strategy)
@@ -195,7 +152,7 @@ will be added to the box
template <typename Box, typename Geometry, typename Strategy>
inline void expand(Box& box, Geometry const& geometry, Strategy const& strategy)
{
- resolve_variant::expand<Geometry>::apply(box, geometry, strategy);
+ resolve_dynamic::expand<Geometry>::apply(box, geometry, strategy);
}
/*!
@@ -213,7 +170,7 @@ added to the box
template <typename Box, typename Geometry>
inline void expand(Box& box, Geometry const& geometry)
{
- resolve_variant::expand<Geometry>::apply(box, geometry, default_strategy());
+ resolve_dynamic::expand<Geometry>::apply(box, geometry, default_strategy());
}
}} // namespace boost::geometry