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.hpp99
1 files changed, 85 insertions, 14 deletions
diff --git a/boost/geometry/algorithms/detail/expand/interface.hpp b/boost/geometry/algorithms/detail/expand/interface.hpp
index 140754af4e..5aacd8e72a 100644
--- a/boost/geometry/algorithms/detail/expand/interface.hpp
+++ b/boost/geometry/algorithms/detail/expand/interface.hpp
@@ -5,9 +5,10 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
-// 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, 2016.
+// Modifications copyright (c) 2015-2016, Oracle and/or its affiliates.
+// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@@ -28,10 +29,50 @@
#include <boost/geometry/algorithms/dispatch/expand.hpp>
+#include <boost/geometry/strategies/default_strategy.hpp>
+
+#include <boost/geometry/strategies/envelope.hpp>
+#include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
+#include <boost/geometry/strategies/spherical/envelope_segment.hpp>
+#include <boost/geometry/strategies/geographic/envelope_segment.hpp>
namespace boost { namespace geometry
{
+namespace resolve_strategy
+{
+
+template <typename Geometry>
+struct expand
+{
+ template <typename Box, typename Strategy>
+ static inline void apply(Box& box,
+ Geometry const& geometry,
+ Strategy const& strategy)
+ {
+ dispatch::expand<Box, Geometry>::apply(box, geometry, strategy);
+ }
+
+ template <typename Box>
+ static inline void apply(Box& box,
+ Geometry const& geometry,
+ default_strategy)
+ {
+ typedef typename point_type<Geometry>::type point_type;
+ typedef typename coordinate_type<point_type>::type coordinate_type;
+
+ typedef typename strategy::envelope::services::default_strategy
+ <
+ typename cs_tag<point_type>::type,
+ coordinate_type
+ >::type strategy_type;
+
+ dispatch::expand<Box, Geometry>::apply(box, geometry, strategy_type());
+ }
+};
+
+} //namespace resolve_strategy
+
namespace resolve_variant
{
@@ -39,40 +80,48 @@ namespace resolve_variant
template <typename Geometry>
struct expand
{
- template <typename Box>
- static inline void apply(Box& box, Geometry const& geometry)
+ template <typename Box, typename Strategy>
+ static inline void apply(Box& box,
+ Geometry const& geometry,
+ Strategy const& strategy)
{
concepts::check<Box>();
concepts::check<Geometry const>();
concepts::check_concepts_and_equal_dimensions<Box, Geometry const>();
- dispatch::expand<Box, Geometry>::apply(box, geometry);
+ resolve_strategy::expand<Geometry>::apply(box, geometry, strategy);
}
};
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct expand<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
{
- template <typename Box>
+ template <typename Box, typename Strategy>
struct visitor: boost::static_visitor<void>
{
Box& m_box;
+ Strategy const& m_strategy;
- visitor(Box& box) : m_box(box) {}
+ 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);
+ return expand<Geometry>::apply(m_box, geometry, m_strategy);
}
};
- template <class Box>
+ template <class Box, typename Strategy>
static inline void
apply(Box& box,
- boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry)
+ boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry,
+ Strategy const& strategy)
{
- return boost::apply_visitor(visitor<Box>(box), geometry);
+ return boost::apply_visitor(visitor<Box, Strategy>(box, strategy),
+ geometry);
}
};
@@ -106,21 +155,43 @@ inline void expand(Box& box, Geometry const& geometry,
}
***/
+/*!
+\brief Expands (with strategy)
+\ingroup expand
+\tparam Box type of the box
+\tparam Geometry \tparam_geometry
+\tparam Strategy \tparam_strategy{expand}
+\param box box to be expanded using another geometry, mutable
+\param geometry \param_geometry geometry which envelope (bounding box)
+\param strategy \param_strategy{expand}
+will be added to the box
+
+\qbk{distinguish,with strategy}
+\qbk{[include reference/algorithms/expand.qbk]}
+ */
+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);
+}
/*!
-\brief Expands a box using the bounding box (envelope) of another geometry (box, point)
+\brief Expands a box using the bounding box (envelope) of another geometry
+(box, point)
\ingroup expand
\tparam Box type of the box
\tparam Geometry \tparam_geometry
\param box box to be expanded using another geometry, mutable
-\param geometry \param_geometry geometry which envelope (bounding box) will be added to the box
+\param geometry \param_geometry geometry which envelope (bounding box) will be
+added to the box
\qbk{[include reference/algorithms/expand.qbk]}
*/
template <typename Box, typename Geometry>
inline void expand(Box& box, Geometry const& geometry)
{
- resolve_variant::expand<Geometry>::apply(box, geometry);
+ resolve_variant::expand<Geometry>::apply(box, geometry, default_strategy());
}
}} // namespace boost::geometry