mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
Remove range_type<> and modify detail::as_range(), plus other minor tweaks.
The rationale behind it is that in all cases range_type<> was used as ring_type<>. There was a specialization for Box defining box_view<> but this was semantically different than accessing a ring of geometry. detail::as_range() was taking a range type and returning a reference to this range which was inconsistent with ring_return_type<>. Remove unneeded begin() and end() functions in non-mutable ranges closeable_view<> and detail::normalized_view<>. Add specialization of ring_type<> for linestrings since there is already specialization of ring_return_type<>. Fix some compilation errors.
This commit is contained in:
parent
5f0ba22310
commit
32aaa05bd0
@ -4,8 +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 2020.
|
||||
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
|
||||
// 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
|
||||
@ -19,7 +19,10 @@
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/not_implemented.hpp>
|
||||
|
||||
#include <boost/geometry/core/exterior_ring.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
@ -33,22 +36,30 @@ namespace dispatch
|
||||
{
|
||||
|
||||
|
||||
template <typename GeometryTag, typename Geometry, typename Range>
|
||||
struct as_range
|
||||
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
|
||||
struct as_range : not_implemented<Geometry, Tag>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct as_range<Geometry, linestring_tag>
|
||||
{
|
||||
static inline Range& get(Geometry& input)
|
||||
static inline typename ring_return_type<Geometry>::type get(Geometry& geometry)
|
||||
{
|
||||
return input;
|
||||
return geometry;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct as_range<Geometry, ring_tag>
|
||||
: as_range<Geometry, linestring_tag>
|
||||
{};
|
||||
|
||||
template <typename Geometry, typename Range>
|
||||
struct as_range<polygon_tag, Geometry, Range>
|
||||
template <typename Geometry>
|
||||
struct as_range<Geometry, polygon_tag>
|
||||
{
|
||||
static inline Range& get(Geometry& input)
|
||||
static inline typename ring_return_type<Geometry>::type get(Geometry& geometry)
|
||||
{
|
||||
return exterior_ring(input);
|
||||
return exterior_ring(geometry);
|
||||
}
|
||||
};
|
||||
|
||||
@ -66,33 +77,10 @@ or the outer ring (polygon)
|
||||
\details Utility to handle polygon's outer ring as a range
|
||||
\ingroup utility
|
||||
*/
|
||||
template <typename Range, typename Geometry>
|
||||
inline Range& as_range(Geometry& input)
|
||||
template <typename Geometry>
|
||||
inline typename ring_return_type<Geometry>::type as_range(Geometry& geometry)
|
||||
{
|
||||
return dispatch::as_range
|
||||
<
|
||||
typename tag<Geometry>::type,
|
||||
Geometry,
|
||||
Range
|
||||
>::get(input);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Function getting either the range (ring, linestring) itself
|
||||
or the outer ring (polygon), const version
|
||||
\details Utility to handle polygon's outer ring as a range
|
||||
\ingroup utility
|
||||
*/
|
||||
template <typename Range, typename Geometry>
|
||||
inline Range const& as_range(Geometry const& input)
|
||||
{
|
||||
return dispatch::as_range
|
||||
<
|
||||
typename tag<Geometry>::type,
|
||||
Geometry const,
|
||||
Range const
|
||||
>::get(input);
|
||||
return dispatch::as_range<Geometry>::get(geometry);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <boost/geometry/strategies/convex_hull/cartesian.hpp>
|
||||
#include <boost/geometry/strategies/convex_hull/geographic.hpp>
|
||||
#include <boost/geometry/strategies/convex_hull/spherical.hpp>
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@ -68,7 +67,8 @@ inline void get_extremes(Geometry const& geometry,
|
||||
auto left_it = boost::begin(range);
|
||||
auto right_it = boost::begin(range);
|
||||
|
||||
for (auto it = ++boost::begin(range); it != boost::end(range); ++it)
|
||||
auto it = boost::begin(range);
|
||||
for (++it; it != boost::end(range); ++it)
|
||||
{
|
||||
if (less(*it, *left_it))
|
||||
{
|
||||
|
@ -27,10 +27,16 @@
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
#include <boost/variant/variant_fwd.hpp>
|
||||
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
#include <boost/geometry/core/point_order.hpp>
|
||||
#include <boost/geometry/algorithms/detail/as_range.hpp>
|
||||
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
|
||||
#include <boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp>
|
||||
#include <boost/geometry/algorithms/is_empty.hpp>
|
||||
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
#include <boost/geometry/core/exterior_ring.hpp>
|
||||
#include <boost/geometry/core/point_order.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/concepts/check.hpp>
|
||||
|
||||
@ -39,13 +45,6 @@
|
||||
|
||||
#include <boost/geometry/util/condition.hpp>
|
||||
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/is_empty.hpp>
|
||||
#include <boost/geometry/algorithms/detail/as_range.hpp>
|
||||
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
|
||||
#include <boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@ -58,7 +57,6 @@ namespace detail { namespace convex_hull
|
||||
template <order_selector Order, closure_selector Closure>
|
||||
struct hull_insert
|
||||
{
|
||||
|
||||
// Member template function (to avoid inconvenient declaration
|
||||
// of output-iterator-type, from hull_to_geometry)
|
||||
template <typename Geometry, typename OutputIterator, typename Strategy>
|
||||
@ -88,17 +86,18 @@ struct hull_to_geometry
|
||||
static inline void apply(Geometry const& geometry, OutputGeometry& out,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
// TODO: Why not handle multi-polygon here?
|
||||
// TODO: detail::as_range() is only used in this place in the whole library
|
||||
// it should probably be located here.
|
||||
// NOTE: A variable is created here because this can be a proxy range
|
||||
// and back_insert_iterator<> can store a pointer to it.
|
||||
// Handle linestring, ring and polygon the same:
|
||||
auto&& range = detail::as_range(out);
|
||||
hull_insert
|
||||
<
|
||||
geometry::point_order<OutputGeometry>::value,
|
||||
geometry::closure<OutputGeometry>::value
|
||||
>::apply(geometry,
|
||||
range::back_inserter(
|
||||
// Handle linestring, ring and polygon the same:
|
||||
detail::as_range
|
||||
<
|
||||
typename range_type<OutputGeometry>::type
|
||||
>(out)), strategy);
|
||||
>::apply(geometry, range::back_inserter(range), strategy);
|
||||
}
|
||||
};
|
||||
|
||||
@ -120,6 +119,7 @@ struct convex_hull
|
||||
: detail::convex_hull::hull_to_geometry
|
||||
{};
|
||||
|
||||
// TODO: This is not correct in spherical and geographic CS
|
||||
template <typename Box>
|
||||
struct convex_hull<Box, box_tag>
|
||||
{
|
||||
|
@ -64,7 +64,6 @@
|
||||
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
#include <boost/geometry/views/reversible_view.hpp>
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
|
||||
@ -218,12 +217,12 @@ class get_turns_in_sections
|
||||
{
|
||||
typedef typename closeable_view
|
||||
<
|
||||
typename range_type<Geometry1>::type const,
|
||||
typename ring_type<Geometry1>::type const,
|
||||
closure<Geometry1>::value
|
||||
>::type cview_type1;
|
||||
typedef typename closeable_view
|
||||
<
|
||||
typename range_type<Geometry2>::type const,
|
||||
typename ring_type<Geometry2>::type const,
|
||||
closure<Geometry2>::value
|
||||
>::type cview_type2;
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ struct linear_areal
|
||||
typename sub_range_return_type<Geometry1 const>::type
|
||||
range1 = sub_range(geometry1, turn.operations[op_id].seg_id);
|
||||
|
||||
typedef detail::normalized_view<Geometry2 const> const range2_type;
|
||||
typedef detail::normalized_view<typename ring_type<Geometry2>::type const> const range2_type;
|
||||
typedef typename boost::range_iterator<range2_type>::type range2_iterator;
|
||||
range2_type range2(sub_range(geometry2, turn.operations[other_op_id].seg_id));
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2013-2020.
|
||||
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2013-2021.
|
||||
// Modifications copyright (c) 2013-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
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2015-2020.
|
||||
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2015-2021.
|
||||
// Modifications copyright (c) 2015-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
|
||||
|
||||
@ -139,6 +139,13 @@ struct ring_type
|
||||
{};
|
||||
|
||||
|
||||
template <typename Linestring>
|
||||
struct ring_type<linestring_tag, Linestring>
|
||||
{
|
||||
typedef Linestring type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Ring>
|
||||
struct ring_type<ring_tag, Ring>
|
||||
{
|
||||
|
@ -1,21 +0,0 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// 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_MULTI_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
#define BOOST_GEOMETRY_MULTI_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_MULTI_VIEWS_DETAIL_RANGE_TYPE_HPP
|
@ -43,11 +43,11 @@ namespace detail
|
||||
template <typename Range>
|
||||
struct closing_view
|
||||
{
|
||||
using iterator = closing_iterator<Range>;
|
||||
using iterator = closing_iterator<Range const>;
|
||||
using const_iterator = closing_iterator<Range const>;
|
||||
|
||||
// Keep this explicit, important for nested views/ranges
|
||||
explicit inline closing_view(Range& r)
|
||||
explicit inline closing_view(Range const& r)
|
||||
: m_begin(r)
|
||||
, m_end(r, true)
|
||||
{}
|
||||
@ -55,12 +55,9 @@ struct closing_view
|
||||
inline const_iterator begin() const { return m_begin; }
|
||||
inline const_iterator end() const { return m_end; }
|
||||
|
||||
inline iterator begin() { return m_begin; }
|
||||
inline iterator end() { return m_end; }
|
||||
|
||||
private:
|
||||
iterator m_begin;
|
||||
iterator m_end;
|
||||
const_iterator m_begin;
|
||||
const_iterator m_end;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,8 @@
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
#include <boost/geometry/views/reversible_view.hpp>
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
#include <boost/geometry/views/reversible_view.hpp>
|
||||
#include <boost/geometry/util/order_as_direction.hpp>
|
||||
#include <boost/geometry/util/type_traits_std.hpp>
|
||||
|
||||
@ -40,41 +39,31 @@ namespace detail {
|
||||
template <typename Geometry>
|
||||
struct normalized_view
|
||||
{
|
||||
using range_type = typename detail::range_type<Geometry>::type;
|
||||
using range = util::transcribe_const_t<Geometry, range_type>;
|
||||
|
||||
using reversible_type = typename reversible_view
|
||||
<
|
||||
range,
|
||||
Geometry const,
|
||||
order_as_direction
|
||||
<
|
||||
geometry::point_order<Geometry>::value
|
||||
>::value
|
||||
>::type;
|
||||
|
||||
using reversible = util::transcribe_const_t<Geometry, reversible_type>;
|
||||
|
||||
using closeable_type = typename closeable_view
|
||||
<
|
||||
reversible,
|
||||
reversible_type const,
|
||||
geometry::closure<Geometry>::value
|
||||
>::type;
|
||||
|
||||
using closeable = util::transcribe_const_t<Geometry, closeable_type>;
|
||||
|
||||
explicit inline normalized_view(range & r)
|
||||
: m_closeable(reversible_type(r))
|
||||
explicit inline normalized_view(Geometry const& g)
|
||||
: m_closeable(reversible_type(g))
|
||||
{}
|
||||
|
||||
typedef typename boost::range_iterator<closeable>::type iterator;
|
||||
typedef typename boost::range_const_iterator<closeable>::type const_iterator;
|
||||
using iterator = typename boost::range_iterator<closeable_type const>::type;
|
||||
using const_iterator = typename boost::range_iterator<closeable_type const>::type;
|
||||
|
||||
inline const_iterator begin() const { return boost::begin(m_closeable); }
|
||||
inline const_iterator end() const { return boost::end(m_closeable); }
|
||||
|
||||
inline iterator begin() { return boost::begin(m_closeable); }
|
||||
inline iterator end() { return boost::end(m_closeable); }
|
||||
|
||||
private:
|
||||
closeable_type m_closeable;
|
||||
};
|
||||
|
@ -1,132 +0,0 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// 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_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
|
||||
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/static_assert.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/views/box_view.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace dispatch
|
||||
{
|
||||
|
||||
|
||||
template <typename Geometry,
|
||||
typename Tag = typename tag<Geometry>::type>
|
||||
struct range_type
|
||||
{
|
||||
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
|
||||
"Not or not yet implemented for this Geometry type.",
|
||||
Geometry, Tag);
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, ring_tag>
|
||||
{
|
||||
typedef Geometry type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, linestring_tag>
|
||||
{
|
||||
typedef Geometry type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, polygon_tag>
|
||||
{
|
||||
typedef typename ring_type<Geometry>::type type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, box_tag>
|
||||
{
|
||||
typedef box_view<Geometry> type;
|
||||
};
|
||||
|
||||
|
||||
// multi-point acts itself as a range
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, multi_point_tag>
|
||||
{
|
||||
typedef Geometry type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, multi_linestring_tag>
|
||||
{
|
||||
typedef typename boost::range_value<Geometry>::type type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, multi_polygon_tag>
|
||||
{
|
||||
// Call its single-version
|
||||
typedef typename dispatch::range_type
|
||||
<
|
||||
typename boost::range_value<Geometry>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
|
||||
} // namespace dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
// Will probably be replaced by the more generic "view_as", therefore in detail
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
/*!
|
||||
\brief Meta-function defining a type which is a boost-range.
|
||||
\details
|
||||
- For linestrings and rings, it defines the type itself.
|
||||
- For polygons it defines the ring type.
|
||||
- For multi-points, it defines the type itself
|
||||
- For multi-polygons and multi-linestrings, it defines the single-version
|
||||
(so in the end the linestring and ring-type-of-multi-polygon)
|
||||
\ingroup iterators
|
||||
*/
|
||||
template <typename Geometry>
|
||||
struct range_type
|
||||
{
|
||||
typedef typename dispatch::range_type
|
||||
<
|
||||
Geometry
|
||||
>::type type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP
|
@ -5,9 +5,8 @@
|
||||
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2014, 2015.
|
||||
// Modifications copyright (c) 2014-2015 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 Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
@ -29,8 +28,6 @@
|
||||
#include <boost/geometry/core/point_order.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/for_each_range.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/multi_point.hpp>
|
||||
|
@ -5,6 +5,10 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// 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.
|
||||
|
||||
@ -15,8 +19,6 @@
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
#include <boost/geometry/algorithms/detail/as_range.hpp>
|
||||
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
@ -24,6 +26,7 @@
|
||||
|
||||
#include <boost/geometry/io/wkt/read.hpp>
|
||||
|
||||
|
||||
template <int D, typename Range>
|
||||
double sum(Range const& range)
|
||||
{
|
||||
@ -40,17 +43,12 @@ template <typename G>
|
||||
void test_geometry(std::string const& wkt, double expected_x, double expected_y)
|
||||
{
|
||||
G geometry;
|
||||
|
||||
// Declare a range-type, compatible with boost::range,
|
||||
// such that range_iterator etc could be called
|
||||
typedef typename bg::detail::range_type<G>::type range_type;
|
||||
|
||||
bg::read_wkt(wkt, geometry);
|
||||
|
||||
double s = sum<0>(bg::detail::as_range<range_type>(geometry));
|
||||
double s = sum<0>(bg::detail::as_range(geometry));
|
||||
BOOST_CHECK_CLOSE(s, expected_x, 0.001);
|
||||
|
||||
s = sum<1>(bg::detail::as_range<range_type>(geometry));
|
||||
s = sum<1>(bg::detail::as_range(geometry));
|
||||
BOOST_CHECK_CLOSE(s, expected_y, 0.001);
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
@ -20,7 +20,6 @@
|
||||
|
||||
#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
|
||||
#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/io/wkt/wkt.hpp>
|
||||
@ -46,7 +45,7 @@ void test_sectionalize(std::string const /*caseid*/, Geometry const& geometry, s
|
||||
|
||||
typedef typename bg::closeable_view
|
||||
<
|
||||
typename bg::detail::range_type<Geometry>::type const,
|
||||
typename bg::ring_type<Geometry>::type const,
|
||||
bg::closure<Geometry>::value
|
||||
>::type cview_type;
|
||||
typedef typename bg::reversible_view
|
||||
|
Loading…
x
Reference in New Issue
Block a user