summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/expand
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:08:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:09:00 +0900
commitb5c87084afaef42b2d058f68091be31988a6a874 (patch)
treeadef9a65870a41181687e11d57fdf98e7629de3c /boost/geometry/algorithms/detail/expand
parent34bd32e225e2a8a94104489b31c42e5801cc1f4a (diff)
downloadboost-b5c87084afaef42b2d058f68091be31988a6a874.tar.gz
boost-b5c87084afaef42b2d058f68091be31988a6a874.tar.bz2
boost-b5c87084afaef42b2d058f68091be31988a6a874.zip
Imported Upstream version 1.64.0upstream/1.64.0
Change-Id: Id9212edd016dd55f21172c427aa7894d1d24148b Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/geometry/algorithms/detail/expand')
-rw-r--r--boost/geometry/algorithms/detail/expand/box.hpp17
-rw-r--r--boost/geometry/algorithms/detail/expand/indexed.hpp25
-rw-r--r--boost/geometry/algorithms/detail/expand/interface.hpp99
-rw-r--r--boost/geometry/algorithms/detail/expand/point.hpp27
-rw-r--r--boost/geometry/algorithms/detail/expand/segment.hpp42
5 files changed, 155 insertions, 55 deletions
diff --git a/boost/geometry/algorithms/detail/expand/box.hpp b/boost/geometry/algorithms/detail/expand/box.hpp
index 4c89e6f1d4..3edb23f5ae 100644
--- a/boost/geometry/algorithms/detail/expand/box.hpp
+++ b/boost/geometry/algorithms/detail/expand/box.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
// Distributed under the Boost Software License, Version 1.0.
@@ -44,16 +45,18 @@ namespace detail { namespace expand
struct box_on_spheroid
{
- template <typename BoxOut, typename BoxIn>
- static inline void apply(BoxOut& box_out, BoxIn const& box_in)
+ template <typename BoxOut, typename BoxIn, typename Strategy>
+ static inline void apply(BoxOut& box_out,
+ BoxIn const& box_in,
+ Strategy const& strategy)
{
// normalize both boxes and convert box-in to be of type of box-out
BoxOut mbrs[2];
- detail::envelope::envelope_box_on_spheroid::apply(box_in, mbrs[0]);
- detail::envelope::envelope_box_on_spheroid::apply(box_out, mbrs[1]);
+ detail::envelope::envelope_box_on_spheroid::apply(box_in, mbrs[0], strategy);
+ detail::envelope::envelope_box_on_spheroid::apply(box_out, mbrs[1], strategy);
// compute the envelope of the two boxes
- detail::envelope::envelope_range_of_boxes::apply(mbrs, box_out);
+ detail::envelope::envelope_range_of_boxes::apply(mbrs, box_out, strategy);
}
};
diff --git a/boost/geometry/algorithms/detail/expand/indexed.hpp b/boost/geometry/algorithms/detail/expand/indexed.hpp
index bdd6eb4506..28cf0e2e4f 100644
--- a/boost/geometry/algorithms/detail/expand/indexed.hpp
+++ b/boost/geometry/algorithms/detail/expand/indexed.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
@@ -49,8 +50,8 @@ template
>
struct indexed_loop
{
- template <typename Box, typename Geometry>
- static inline void apply(Box& box, Geometry const& source)
+ template <typename Box, typename Geometry, typename Strategy>
+ static inline void apply(Box& box, Geometry const& source, Strategy const& strategy)
{
typedef typename strategy::compare::detail::select_strategy
<
@@ -87,7 +88,7 @@ struct indexed_loop
<
StrategyLess, StrategyGreater,
Index, Dimension + 1, DimensionCount
- >::apply(box, source);
+ >::apply(box, source, strategy);
}
};
@@ -103,8 +104,8 @@ struct indexed_loop
Index, DimensionCount, DimensionCount
>
{
- template <typename Box, typename Geometry>
- static inline void apply(Box&, Geometry const&) {}
+ template <typename Box, typename Geometry, typename Strategy>
+ static inline void apply(Box&, Geometry const&, Strategy const&) {}
};
@@ -117,20 +118,22 @@ template
>
struct expand_indexed
{
- template <typename Box, typename Geometry>
- static inline void apply(Box& box, Geometry const& geometry)
+ template <typename Box, typename Geometry, typename Strategy>
+ static inline void apply(Box& box,
+ Geometry const& geometry,
+ Strategy const& strategy)
{
indexed_loop
<
StrategyLess, StrategyGreater,
0, Dimension, DimensionCount
- >::apply(box, geometry);
+ >::apply(box, geometry, strategy);
indexed_loop
<
StrategyLess, StrategyGreater,
1, Dimension, DimensionCount
- >::apply(box, geometry);
+ >::apply(box, geometry, strategy);
}
};
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
diff --git a/boost/geometry/algorithms/detail/expand/point.hpp b/boost/geometry/algorithms/detail/expand/point.hpp
index 56b7f1c738..f0cbd1db02 100644
--- a/boost/geometry/algorithms/detail/expand/point.hpp
+++ b/boost/geometry/algorithms/detail/expand/point.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
@@ -59,8 +60,8 @@ template
>
struct point_loop
{
- template <typename Box, typename Point>
- static inline void apply(Box& box, Point const& source)
+ template <typename Box, typename Point, typename Strategy>
+ static inline void apply(Box& box, Point const& source, Strategy const& strategy)
{
typedef typename strategy::compare::detail::select_strategy
<
@@ -95,22 +96,24 @@ struct point_loop
point_loop
<
StrategyLess, StrategyGreater, Dimension + 1, DimensionCount
- >::apply(box, source);
+ >::apply(box, source, strategy);
}
};
template
<
- typename StrategyLess, typename StrategyGreater, std::size_t DimensionCount
+ typename StrategyLess,
+ typename StrategyGreater,
+ std::size_t DimensionCount
>
struct point_loop
<
StrategyLess, StrategyGreater, DimensionCount, DimensionCount
>
{
- template <typename Box, typename Point>
- static inline void apply(Box&, Point const&) {}
+ template <typename Box, typename Point, typename Strategy>
+ static inline void apply(Box&, Point const&, Strategy const&) {}
};
@@ -123,8 +126,10 @@ template
>
struct point_loop_on_spheroid
{
- template <typename Box, typename Point>
- static inline void apply(Box& box, Point const& point)
+ template <typename Box, typename Point, typename Strategy>
+ static inline void apply(Box& box,
+ Point const& point,
+ Strategy const& strategy)
{
typedef typename point_type<Box>::type box_point_type;
typedef typename coordinate_type<Box>::type box_coordinate_type;
@@ -224,7 +229,7 @@ struct point_loop_on_spheroid
point_loop
<
StrategyLess, StrategyGreater, 2, DimensionCount
- >::apply(box, point);
+ >::apply(box, point, strategy);
}
};
diff --git a/boost/geometry/algorithms/detail/expand/segment.hpp b/boost/geometry/algorithms/detail/expand/segment.hpp
index 041c1e175f..0570e944d4 100644
--- a/boost/geometry/algorithms/detail/expand/segment.hpp
+++ b/boost/geometry/algorithms/detail/expand/segment.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
// Distributed under the Boost Software License, Version 1.0.
@@ -39,25 +40,29 @@ namespace boost { namespace geometry
namespace detail { namespace expand
{
-
-struct segment_on_sphere
+struct segment
{
- template <typename Box, typename Segment>
- static inline void apply(Box& box, Segment const& segment)
+ template <typename Box, typename Segment, typename Strategy>
+ static inline void apply(Box& box,
+ Segment const& segment,
+ Strategy const& strategy)
{
Box mbrs[2];
// compute the envelope of the segment
- detail::envelope::envelope_segment_on_sphere
+ typename point_type<Segment>::type p[2];
+ detail::assign_point_from_index<0>(segment, p[0]);
+ detail::assign_point_from_index<1>(segment, p[1]);
+ detail::envelope::envelope_segment
<
dimension<Segment>::value
- >::apply(segment, mbrs[0]);
+ >::apply(p[0], p[1], mbrs[0], strategy);
// normalize the box
- detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1]);
+ detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1], strategy);
// compute the envelope of the two boxes
- detail::envelope::envelope_range_of_boxes::apply(mbrs, box);
+ detail::envelope::envelope_range_of_boxes::apply(mbrs, box, strategy);
}
};
@@ -69,7 +74,6 @@ struct segment_on_sphere
namespace dispatch
{
-
template
<
typename Box, typename Segment,
@@ -103,13 +107,27 @@ struct expand
StrategyLess, StrategyGreater,
box_tag, segment_tag,
spherical_equatorial_tag, spherical_equatorial_tag
- > : detail::expand::segment_on_sphere
+ > : detail::expand::segment
{};
+template
+<
+ typename Box, typename Segment,
+ typename StrategyLess, typename StrategyGreater
+>
+struct expand
+ <
+ Box, Segment,
+ StrategyLess, StrategyGreater,
+ box_tag, segment_tag,
+ geographic_tag, geographic_tag
+ > : detail::expand::segment
+{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
+
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP