update boost
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// 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
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
@@ -15,16 +19,30 @@
|
||||
#define BOOST_GEOMETRY_VIEWS_BOX_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <array>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
|
||||
#include <boost/geometry/core/point_order.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
#include <boost/geometry/views/detail/points_view.hpp>
|
||||
#include <boost/geometry/algorithms/assign.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
// NOTE: This is equivalent to the previous implementation with detail::points_view.
|
||||
// Technically this should not be called a view because it owns the elements.
|
||||
// It's also not a borrowed_range because of dangling iterators after the
|
||||
// destruction.
|
||||
// It's a container or more specifically a ring of some sort, e.g. static_ring.
|
||||
// NOTE: It would be possible to implement a borrowed_range or a view.
|
||||
// The iterators would have to store copies of points.
|
||||
// Another possibility is to store the original Box or reference/pointer
|
||||
// to Box and index. But then the reference would be the value type
|
||||
// so technically they would be InputIterators not RandomAccessIterators.
|
||||
// NOTE: This object can not represent a Box correctly in all coordinates systems.
|
||||
// It's correct only in cartesian CS so maybe it should be removed entirely.
|
||||
|
||||
|
||||
/*!
|
||||
\brief Makes a box behave like a ring or a range
|
||||
@@ -44,41 +62,24 @@ namespace boost { namespace geometry
|
||||
*/
|
||||
template <typename Box, bool Clockwise = true>
|
||||
struct box_view
|
||||
: public detail::points_view
|
||||
<
|
||||
typename geometry::point_type<Box>::type,
|
||||
5
|
||||
>
|
||||
{
|
||||
typedef typename geometry::point_type<Box>::type point_type;
|
||||
using array_t = std::array<typename geometry::point_type<Box>::type, 5>;
|
||||
|
||||
using iterator = typename array_t::const_iterator;
|
||||
using const_iterator = typename array_t::const_iterator;
|
||||
|
||||
/// Constructor accepting the box to adapt
|
||||
explicit box_view(Box const& box)
|
||||
: detail::points_view<point_type, 5>(copy_policy(box))
|
||||
{}
|
||||
|
||||
private :
|
||||
|
||||
class copy_policy
|
||||
{
|
||||
public :
|
||||
inline copy_policy(Box const& box)
|
||||
: m_box(box)
|
||||
{}
|
||||
detail::assign_box_corners_oriented<!Clockwise>(box, m_array);
|
||||
m_array[4] = m_array[0];
|
||||
}
|
||||
|
||||
inline void apply(point_type* points) const
|
||||
{
|
||||
// assign_box_corners_oriented requires a range
|
||||
// an alternative for this workaround would be to pass a range here,
|
||||
// e.g. use boost::array in points_view instead of c-array
|
||||
std::pair<point_type*, point_type*> rng = std::make_pair(points, points + 5);
|
||||
detail::assign_box_corners_oriented<!Clockwise>(m_box, rng);
|
||||
points[4] = points[0];
|
||||
}
|
||||
private :
|
||||
Box const& m_box;
|
||||
};
|
||||
const_iterator begin() const noexcept { return m_array.begin(); }
|
||||
const_iterator end() const noexcept { return m_array.end(); }
|
||||
|
||||
private:
|
||||
array_t m_array;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2020-2023.
|
||||
// Modifications copyright (c) 2020-2023 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// 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.
|
||||
|
||||
@@ -14,10 +19,8 @@
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range.hpp>
|
||||
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
#include <boost/geometry/core/point_order.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
@@ -28,39 +31,56 @@
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
// Silence warning C4512: assignment operator could not be generated
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4512)
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Range>
|
||||
struct closing_view
|
||||
{
|
||||
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)
|
||||
: m_range(r)
|
||||
explicit inline closing_view(Range const& r)
|
||||
: m_begin(r)
|
||||
, m_end(r, true)
|
||||
{}
|
||||
|
||||
typedef closing_iterator<Range> iterator;
|
||||
typedef closing_iterator<Range const> const_iterator;
|
||||
inline const_iterator begin() const { return m_begin; }
|
||||
inline const_iterator end() const { return m_end; }
|
||||
|
||||
inline const_iterator begin() const { return const_iterator(m_range); }
|
||||
inline const_iterator end() const { return const_iterator(m_range, true); }
|
||||
|
||||
inline iterator begin() { return iterator(m_range); }
|
||||
inline iterator end() { return iterator(m_range, true); }
|
||||
private :
|
||||
Range& m_range;
|
||||
private:
|
||||
const_iterator m_begin;
|
||||
const_iterator m_end;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename Range,
|
||||
closure_selector Close = geometry::closure<Range>::value
|
||||
>
|
||||
struct closed_view
|
||||
: identity_view<Range>
|
||||
{
|
||||
explicit inline closed_view(Range const& r)
|
||||
: identity_view<Range const>(r)
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename Range>
|
||||
struct closed_view<Range, open>
|
||||
: closing_view<Range>
|
||||
{
|
||||
explicit inline closed_view(Range const& r)
|
||||
: closing_view<Range const>(r)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
@@ -86,22 +106,44 @@ struct closeable_view {};
|
||||
template <typename Range>
|
||||
struct closeable_view<Range, closed>
|
||||
{
|
||||
typedef identity_view<Range> type;
|
||||
using type = identity_view<Range>;
|
||||
};
|
||||
|
||||
|
||||
template <typename Range>
|
||||
struct closeable_view<Range, open>
|
||||
{
|
||||
typedef detail::closing_view<Range> type;
|
||||
using type = detail::closing_view<Range>;
|
||||
};
|
||||
|
||||
#endif // DOXYGEN_NO_SPECIALIZATIONS
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
|
||||
template <typename Range, closure_selector Close>
|
||||
struct tag<geometry::detail::closed_view<Range, Close> >
|
||||
: geometry::tag<Range>
|
||||
{};
|
||||
|
||||
template <typename Range, closure_selector Close>
|
||||
struct point_order<geometry::detail::closed_view<Range, Close> >
|
||||
: geometry::point_order<Range>
|
||||
{};
|
||||
|
||||
template <typename Range, closure_selector Close>
|
||||
struct closure<geometry::detail::closed_view<Range, Close> >
|
||||
{
|
||||
static const closure_selector value = closed;
|
||||
};
|
||||
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, 2018, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2015-2020 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
|
||||
@@ -16,34 +16,27 @@
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/num_interior_rings.hpp>
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
#include <boost/geometry/core/exterior_ring.hpp>
|
||||
#include <boost/geometry/core/interior_rings.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/static_assert.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/iterators/flatten_iterator.hpp>
|
||||
|
||||
#include <boost/geometry/util/range.hpp>
|
||||
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
#include <boost/geometry/views/detail/boundary_view/interface.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/num_interior_rings.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@@ -61,7 +54,7 @@ template
|
||||
typename Reference = typename ring_return_type<Polygon>::type,
|
||||
typename Difference = typename boost::range_difference
|
||||
<
|
||||
typename boost::remove_reference
|
||||
typename std::remove_reference
|
||||
<
|
||||
typename interior_return_type<Polygon>::type
|
||||
>::type
|
||||
@@ -79,7 +72,7 @@ class polygon_rings_iterator
|
||||
{
|
||||
typedef typename boost::range_size
|
||||
<
|
||||
typename boost::remove_reference
|
||||
typename std::remove_reference
|
||||
<
|
||||
typename interior_return_type<Polygon>::type
|
||||
>::type
|
||||
@@ -122,11 +115,11 @@ public:
|
||||
, m_index(other.m_index)
|
||||
{
|
||||
static const bool is_convertible
|
||||
= boost::is_convertible<OtherPolygon, Polygon>::value;
|
||||
= std::is_convertible<OtherPolygon, Polygon>::value;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG((is_convertible),
|
||||
NOT_CONVERTIBLE,
|
||||
(types<OtherPolygon>));
|
||||
BOOST_GEOMETRY_STATIC_ASSERT((is_convertible),
|
||||
"OtherPolygon has to be convertible to Polygon.",
|
||||
OtherPolygon, Polygon);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -224,7 +217,7 @@ private:
|
||||
public:
|
||||
typedef typename base_type::iterator iterator;
|
||||
typedef typename base_type::const_iterator const_iterator;
|
||||
|
||||
|
||||
typedef linestring_tag tag_type;
|
||||
|
||||
explicit ring_boundary(Ring& ring)
|
||||
@@ -282,12 +275,12 @@ struct views_container_initializer<Polygon, polygon_tag>
|
||||
template <typename MultiPolygon>
|
||||
class views_container_initializer<MultiPolygon, multi_polygon_tag>
|
||||
{
|
||||
typedef typename boost::mpl::if_
|
||||
typedef std::conditional_t
|
||||
<
|
||||
boost::is_const<MultiPolygon>,
|
||||
std::is_const<MultiPolygon>::value,
|
||||
typename boost::range_value<MultiPolygon>::type const,
|
||||
typename boost::range_value<MultiPolygon>::type
|
||||
>::type polygon_type;
|
||||
> polygon_type;
|
||||
|
||||
typedef polygon_rings_iterator<polygon_type> inner_iterator_type;
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// 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.
|
||||
|
||||
// This file was modified by Oracle on 2014-2021.
|
||||
// Modifications copyright (c) 2014-2023 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// 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.
|
||||
|
||||
// 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_CLOSED_CLOCKWISE_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_CLOSED_CLOCKWISE_VIEW_HPP
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.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>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Range,
|
||||
closure_selector Closure = geometry::closure<Range>::value,
|
||||
order_selector Order = geometry::point_order<Range>::value
|
||||
>
|
||||
struct closed_clockwise_view
|
||||
{
|
||||
using closed_view = detail::closed_view<Range const, Closure>;
|
||||
using view = detail::clockwise_view<closed_view const, Order>;
|
||||
|
||||
explicit inline closed_clockwise_view(Range const& r)
|
||||
: m_view(closed_view(r))
|
||||
{}
|
||||
|
||||
using iterator = typename boost::range_iterator<view const>::type;
|
||||
using const_iterator = typename boost::range_iterator<view const>::type;
|
||||
|
||||
inline const_iterator begin() const { return boost::begin(m_view); }
|
||||
inline const_iterator end() const { return boost::end(m_view); }
|
||||
|
||||
private:
|
||||
view m_view;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
template <typename Range, closure_selector Closure, order_selector Order>
|
||||
struct tag<geometry::detail::closed_clockwise_view<Range, Closure, Order> >
|
||||
: geometry::tag<Range>
|
||||
{};
|
||||
|
||||
template <typename Range, closure_selector Closure, order_selector Order>
|
||||
struct point_order<geometry::detail::closed_clockwise_view<Range, Closure, Order> >
|
||||
{
|
||||
static const order_selector value = clockwise;
|
||||
};
|
||||
|
||||
template <typename Range, closure_selector Closure, order_selector Order>
|
||||
struct closure<geometry::detail::closed_clockwise_view<Range, Closure, Order> >
|
||||
{
|
||||
static const closure_selector value = closed;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_CLOSED_CLOCKWISE_VIEW_HPP
|
||||
@@ -0,0 +1,84 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2022, 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_VIEWS_GEOMETRY_COLLECTION_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_GEOMETRY_COLLECTION_VIEW_HPP
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
|
||||
#include <boost/geometry/core/geometry_types.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
#include <boost/geometry/core/visit.hpp>
|
||||
#include <boost/geometry/util/sequence.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
class geometry_collection_view
|
||||
{
|
||||
public:
|
||||
using iterator = Geometry const*;
|
||||
using const_iterator = Geometry const*;
|
||||
|
||||
explicit geometry_collection_view(Geometry const& geometry)
|
||||
: m_geometry(geometry)
|
||||
{}
|
||||
|
||||
const_iterator begin() const { return boost::addressof(m_geometry); }
|
||||
const_iterator end() const { return boost::addressof(m_geometry) + 1; }
|
||||
|
||||
private:
|
||||
Geometry const& m_geometry;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
template <typename Geometry>
|
||||
struct tag<geometry::detail::geometry_collection_view<Geometry>>
|
||||
{
|
||||
using type = geometry_collection_tag;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct geometry_types<geometry::detail::geometry_collection_view<Geometry>>
|
||||
{
|
||||
using type = util::type_sequence<Geometry>;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct iter_visit<geometry::detail::geometry_collection_view<Geometry>>
|
||||
{
|
||||
template <typename Function, typename Iterator>
|
||||
static void apply(Function && function, Iterator iterator)
|
||||
{
|
||||
function(*iterator);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_GEOMETRY_COLLECTION_VIEW_HPP
|
||||
@@ -1,117 +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.
|
||||
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// 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)
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.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/util/order_as_direction.hpp>
|
||||
|
||||
namespace boost { namespace geometry {
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Geometry>
|
||||
struct normalized_view
|
||||
{
|
||||
static const bool is_const = boost::is_const<Geometry>::value;
|
||||
|
||||
//typedef typename ring_type<Geometry>::type ring_type;
|
||||
|
||||
typedef typename detail::range_type<Geometry>::type range_type;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_c
|
||||
<
|
||||
is_const,
|
||||
range_type const,
|
||||
range_type
|
||||
>::type range;
|
||||
|
||||
typedef typename
|
||||
reversible_view
|
||||
<
|
||||
range,
|
||||
order_as_direction
|
||||
<
|
||||
geometry::point_order<Geometry>::value
|
||||
>::value
|
||||
>::type reversible_type;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_c
|
||||
<
|
||||
is_const,
|
||||
reversible_type const,
|
||||
reversible_type
|
||||
>::type reversible;
|
||||
|
||||
typedef typename
|
||||
closeable_view
|
||||
<
|
||||
reversible,
|
||||
geometry::closure<Geometry>::value
|
||||
>::type closeable_type;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_c
|
||||
<
|
||||
is_const,
|
||||
closeable_type const,
|
||||
closeable_type
|
||||
>::type closeable;
|
||||
|
||||
explicit inline normalized_view(range & r)
|
||||
: m_reversible(r)
|
||||
, m_closeable(m_reversible)
|
||||
{}
|
||||
|
||||
typedef typename boost::range_iterator<closeable>::type iterator;
|
||||
typedef typename boost::range_const_iterator<closeable>::type const_iterator;
|
||||
|
||||
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:
|
||||
reversible_type m_reversible;
|
||||
closeable_type m_closeable;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
||||
@@ -1,141 +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_POINTS_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_POINTS_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
#include <boost/geometry/core/exception.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Adapts pointer, on points, to a Boost.Range
|
||||
template <typename Point, int MaxSize>
|
||||
class points_view
|
||||
{
|
||||
// Iterates over a series of points (indicated by pointer
|
||||
// to have it lightweight). Probably there is already an
|
||||
// equivalent of this within Boost. If so, TODO: use that one.
|
||||
// This used to be "box_iterator" and "segment_iterator".
|
||||
// ALTERNATIVE: use boost:array and its iterators
|
||||
struct points_iterator
|
||||
: public boost::iterator_facade
|
||||
<
|
||||
points_iterator,
|
||||
Point const,
|
||||
boost::random_access_traversal_tag
|
||||
>
|
||||
{
|
||||
// Constructor: Begin iterator
|
||||
inline points_iterator(Point const* p)
|
||||
: m_points(p)
|
||||
, m_index(0)
|
||||
{}
|
||||
|
||||
// Constructor: End iterator
|
||||
inline points_iterator(Point const* p, bool)
|
||||
: m_points(p)
|
||||
, m_index(MaxSize)
|
||||
{}
|
||||
|
||||
// Constructor: default (for Range Concept checking).
|
||||
inline points_iterator()
|
||||
: m_points(NULL)
|
||||
, m_index(MaxSize)
|
||||
{}
|
||||
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
private:
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
inline Point const& dereference() const
|
||||
{
|
||||
if (m_index >= 0 && m_index < MaxSize)
|
||||
{
|
||||
return m_points[m_index];
|
||||
}
|
||||
|
||||
// If it index larger (or smaller) return first point
|
||||
// (assuming initialized)
|
||||
return m_points[0];
|
||||
}
|
||||
|
||||
inline bool equal(points_iterator const& other) const
|
||||
{
|
||||
return other.m_index == this->m_index;
|
||||
}
|
||||
|
||||
inline void increment()
|
||||
{
|
||||
m_index++;
|
||||
}
|
||||
|
||||
inline void decrement()
|
||||
{
|
||||
m_index--;
|
||||
}
|
||||
|
||||
inline difference_type distance_to(points_iterator const& other) const
|
||||
{
|
||||
return other.m_index - this->m_index;
|
||||
}
|
||||
|
||||
inline void advance(difference_type n)
|
||||
{
|
||||
m_index += n;
|
||||
}
|
||||
|
||||
Point const* m_points;
|
||||
difference_type m_index;
|
||||
};
|
||||
|
||||
public :
|
||||
|
||||
typedef points_iterator const_iterator;
|
||||
typedef points_iterator iterator; // must be defined
|
||||
|
||||
const_iterator begin() const { return const_iterator(m_points); }
|
||||
const_iterator end() const { return const_iterator(m_points, true); }
|
||||
|
||||
// It may NOT be used non-const, so commented:
|
||||
//iterator begin() { return m_begin; }
|
||||
//iterator end() { return m_end; }
|
||||
|
||||
protected :
|
||||
|
||||
template <typename CopyPolicy>
|
||||
explicit points_view(CopyPolicy const& copy)
|
||||
{
|
||||
copy.apply(m_points);
|
||||
}
|
||||
|
||||
private :
|
||||
// Copy points here - box might define them otherwise
|
||||
Point m_points[MaxSize];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_POINTS_VIEW_HPP
|
||||
@@ -0,0 +1,222 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2022-2023, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// 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_VIEWS_DETAIL_RANDOM_ACCESS_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_RANDOM_ACCESS_VIEW_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/size.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/visit.hpp>
|
||||
#include <boost/geometry/core/geometry_types.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
#include <boost/geometry/util/sequence.hpp>
|
||||
#include <boost/geometry/util/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
template <typename Range>
|
||||
struct is_random_access_range
|
||||
: std::is_convertible
|
||||
<
|
||||
typename boost::iterator_traversal
|
||||
<
|
||||
typename boost::range_iterator<Range>::type
|
||||
>::type,
|
||||
boost::random_access_traversal_tag
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Geometry>
|
||||
struct is_geometry_collection_recursive
|
||||
: util::bool_constant
|
||||
<
|
||||
util::is_geometry_collection
|
||||
<
|
||||
typename util::sequence_find_if
|
||||
<
|
||||
typename traits::geometry_types<std::remove_const_t<Geometry>>::type,
|
||||
util::is_geometry_collection
|
||||
>::type
|
||||
>::value
|
||||
>
|
||||
{};
|
||||
|
||||
template
|
||||
<
|
||||
typename GeometryCollection,
|
||||
bool IsRandomAccess = is_random_access_range<GeometryCollection>::value,
|
||||
bool IsRecursive = is_geometry_collection_recursive<GeometryCollection>::value
|
||||
>
|
||||
class random_access_view
|
||||
: public std::vector<typename boost::range_iterator<GeometryCollection>::type>
|
||||
{
|
||||
// NOTE: An alternative would be to implement iterator holding base iterators
|
||||
// to geometry collections of lower levels to process after the current level
|
||||
// of bfs traversal is finished.
|
||||
|
||||
using base_t = std::vector<typename boost::range_iterator<GeometryCollection>::type>;
|
||||
|
||||
public:
|
||||
random_access_view(GeometryCollection & geometry)
|
||||
{
|
||||
this->reserve(boost::size(geometry));
|
||||
detail::visit_breadth_first_impl<true>::apply([&](auto&&, auto iter)
|
||||
{
|
||||
this->push_back(iter);
|
||||
return true;
|
||||
}, geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename GeometryCollection>
|
||||
class random_access_view<GeometryCollection, true, false>
|
||||
{
|
||||
public:
|
||||
using iterator = typename boost::range_iterator<GeometryCollection>::type;
|
||||
using const_iterator = typename boost::range_const_iterator<GeometryCollection>::type;
|
||||
|
||||
random_access_view(GeometryCollection & geometry)
|
||||
: m_begin(boost::begin(geometry))
|
||||
, m_end(boost::end(geometry))
|
||||
{}
|
||||
|
||||
iterator begin() { return m_begin; }
|
||||
iterator end() { return m_end; }
|
||||
const_iterator begin() const { return m_begin; }
|
||||
const_iterator end() const { return m_end; }
|
||||
|
||||
private:
|
||||
iterator m_begin, m_end;
|
||||
};
|
||||
|
||||
|
||||
template <typename GeometryCollection>
|
||||
struct random_access_view_iter_visit
|
||||
{
|
||||
template <typename Function, typename Iterator>
|
||||
static void apply(Function && function, Iterator iterator)
|
||||
{
|
||||
geometry::traits::iter_visit
|
||||
<
|
||||
std::remove_const_t<GeometryCollection>
|
||||
>::apply(std::forward<Function>(function), *iterator);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename ...Ts>
|
||||
struct remove_geometry_collections_pack
|
||||
{
|
||||
using type = util::type_sequence<>;
|
||||
};
|
||||
|
||||
template <typename T, typename ...Ts>
|
||||
struct remove_geometry_collections_pack<T, Ts...>
|
||||
{
|
||||
using next_sequence = typename remove_geometry_collections_pack<Ts...>::type;
|
||||
using type = std::conditional_t
|
||||
<
|
||||
util::is_geometry_collection<T>::value,
|
||||
next_sequence,
|
||||
typename util::sequence_merge<util::type_sequence<T>, next_sequence>::type
|
||||
>;
|
||||
};
|
||||
|
||||
template <typename Types>
|
||||
struct remove_geometry_collections;
|
||||
|
||||
template <typename ...Ts>
|
||||
struct remove_geometry_collections<util::type_sequence<Ts...>>
|
||||
: remove_geometry_collections_pack<Ts...>
|
||||
{};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
template<typename GeometryCollection, bool IsRandomAccess, bool IsRecursive>
|
||||
struct tag<geometry::detail::random_access_view<GeometryCollection, IsRandomAccess, IsRecursive>>
|
||||
{
|
||||
using type = geometry_collection_tag;
|
||||
};
|
||||
|
||||
|
||||
template <typename GeometryCollection>
|
||||
struct iter_visit<geometry::detail::random_access_view<GeometryCollection, false, false>>
|
||||
: geometry::detail::random_access_view_iter_visit<GeometryCollection>
|
||||
{};
|
||||
|
||||
template <typename GeometryCollection>
|
||||
struct iter_visit<geometry::detail::random_access_view<GeometryCollection, true, true>>
|
||||
: geometry::detail::random_access_view_iter_visit<GeometryCollection>
|
||||
{};
|
||||
|
||||
template <typename GeometryCollection>
|
||||
struct iter_visit<geometry::detail::random_access_view<GeometryCollection, false, true>>
|
||||
: geometry::detail::random_access_view_iter_visit<GeometryCollection>
|
||||
{};
|
||||
|
||||
template <typename GeometryCollection>
|
||||
struct iter_visit<geometry::detail::random_access_view<GeometryCollection, true, false>>
|
||||
{
|
||||
template <typename Function, typename Iterator>
|
||||
static void apply(Function && function, Iterator iterator)
|
||||
{
|
||||
geometry::traits::iter_visit
|
||||
<
|
||||
std::remove_const_t<GeometryCollection>
|
||||
>::apply(std::forward<Function>(function), iterator);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename GeometryCollection, bool IsRandomAccess>
|
||||
struct geometry_types<geometry::detail::random_access_view<GeometryCollection, IsRandomAccess, false>>
|
||||
: traits::geometry_types
|
||||
<
|
||||
std::remove_const_t<GeometryCollection>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename GeometryCollection, bool IsRandomAccess>
|
||||
struct geometry_types<geometry::detail::random_access_view<GeometryCollection, IsRandomAccess, true>>
|
||||
: geometry::detail::remove_geometry_collections
|
||||
<
|
||||
typename traits::geometry_types
|
||||
<
|
||||
std::remove_const_t<GeometryCollection>
|
||||
>::type
|
||||
>
|
||||
{};
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_RANDOM_ACCESS_VIEW_HPP
|
||||
@@ -1,134 +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/mpl/assert.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/geometry/core/ring_type.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_MPL_ASSERT_MSG
|
||||
(
|
||||
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
|
||||
, (types<Geometry>)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
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
|
||||
@@ -1,8 +1,9 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2015-2020, 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
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
@@ -12,14 +13,12 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/core/coordinate_system.hpp>
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
#include <boost/geometry/core/static_assert.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
@@ -50,15 +49,15 @@ struct two_dimensional_view
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct two_dimensional_view<Point, Dimension1, Dimension2, point_tag>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(Dimension1 < static_cast<std::size_t>(dimension<Point>::value)),
|
||||
COORDINATE_DIMENSION1_IS_LARGER_THAN_POINT_DIMENSION,
|
||||
(boost::mpl::int_<Dimension1>));
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(Dimension1 < dimension<Point>::value),
|
||||
"Coordinate Dimension1 is larger than Point's dimension.",
|
||||
std::integral_constant<std::size_t, Dimension1>);
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(Dimension2 < static_cast<std::size_t>(dimension<Point>::value)),
|
||||
COORDINATE_DIMENSION2_IS_LARGER_THAN_POINT_DIMENSION,
|
||||
(boost::mpl::int_<Dimension2>));
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(Dimension2 < dimension<Point>::value),
|
||||
"Coordinate Dimension2 is larger than Point's dimension.",
|
||||
std::integral_constant<std::size_t, Dimension2>);
|
||||
|
||||
two_dimensional_view(Point& point)
|
||||
: m_point(point)
|
||||
@@ -116,7 +115,7 @@ struct dimension
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>
|
||||
> : boost::mpl::int_<2>
|
||||
> : std::integral_constant<std::size_t, 2>
|
||||
{};
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// 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
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
@@ -14,8 +18,10 @@
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -35,20 +41,23 @@ namespace boost { namespace geometry
|
||||
template <typename Range>
|
||||
struct identity_view
|
||||
{
|
||||
typedef typename boost::range_iterator<Range const>::type const_iterator;
|
||||
typedef typename boost::range_iterator<Range>::type iterator;
|
||||
using const_iterator = typename boost::range_iterator<Range const>::type;
|
||||
using iterator = typename boost::range_iterator<Range>::type;
|
||||
|
||||
explicit inline identity_view(Range& r)
|
||||
: m_range(r)
|
||||
: m_begin(boost::begin(r))
|
||||
, m_end(boost::end(r))
|
||||
{}
|
||||
|
||||
inline const_iterator begin() const { return boost::begin(m_range); }
|
||||
inline const_iterator end() const { return boost::end(m_range); }
|
||||
inline const_iterator begin() const { return m_begin; }
|
||||
inline const_iterator end() const { return m_end; }
|
||||
|
||||
inline iterator begin() { return boost::begin(m_range); }
|
||||
inline iterator end() { return boost::end(m_range); }
|
||||
private :
|
||||
Range& m_range;
|
||||
inline iterator begin() { return m_begin; }
|
||||
inline iterator end() { return m_end; }
|
||||
|
||||
private:
|
||||
iterator m_begin;
|
||||
iterator m_end;
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2020-2023.
|
||||
// Modifications copyright (c) 2020-2023 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// 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.
|
||||
|
||||
@@ -16,23 +21,53 @@
|
||||
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
#include <boost/geometry/core/point_order.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/util/order_as_direction.hpp>
|
||||
|
||||
#include <boost/geometry/views/identity_view.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
/*!
|
||||
\brief Flag for iterating a reversible_view in forward or reverse direction
|
||||
\ingroup views
|
||||
*/
|
||||
enum iterate_direction { iterate_forward, iterate_reverse };
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Range,
|
||||
order_selector Order = geometry::point_order<Range>::value
|
||||
>
|
||||
struct clockwise_view
|
||||
: identity_view<Range>
|
||||
{
|
||||
explicit inline clockwise_view(Range& r)
|
||||
: identity_view<Range>(r)
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename Range>
|
||||
struct clockwise_view<Range, counterclockwise>
|
||||
: boost::reversed_range<Range>
|
||||
{
|
||||
explicit inline clockwise_view(Range& r)
|
||||
: boost::reversed_range<Range>(r)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
/*!
|
||||
\brief View on a range, reversing direction if necessary
|
||||
@@ -44,30 +79,50 @@ template <typename Range, iterate_direction Direction>
|
||||
struct reversible_view {};
|
||||
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_SPECIALIZATIONS
|
||||
|
||||
template <typename Range>
|
||||
struct reversible_view<Range, iterate_forward>
|
||||
{
|
||||
typedef identity_view<Range> type;
|
||||
using type = identity_view<Range>;
|
||||
};
|
||||
|
||||
|
||||
template <typename Range>
|
||||
struct reversible_view<Range, iterate_reverse>
|
||||
{
|
||||
#if BOOST_VERSION > 104500
|
||||
typedef boost::reversed_range<Range> type;
|
||||
#else
|
||||
// For older versions of Boost
|
||||
typedef boost::range_detail::reverse_range<Range> type;
|
||||
#endif
|
||||
using type = boost::reversed_range<Range>;
|
||||
};
|
||||
|
||||
#endif // DOXYGEN_NO_SPECIALIZATIONS
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
|
||||
template <typename Range, order_selector Order>
|
||||
struct tag<geometry::detail::clockwise_view<Range, Order> >
|
||||
: geometry::tag<Range>
|
||||
{};
|
||||
|
||||
template <typename Range, order_selector Order>
|
||||
struct point_order<geometry::detail::clockwise_view<Range, Order> >
|
||||
{
|
||||
static const order_selector value = clockwise;
|
||||
};
|
||||
|
||||
template <typename Range, order_selector Order>
|
||||
struct closure<geometry::detail::clockwise_view<Range, Order> >
|
||||
: geometry::closure<Range>
|
||||
{};
|
||||
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// 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
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
@@ -15,16 +19,27 @@
|
||||
#define BOOST_GEOMETRY_VIEWS_SEGMENT_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <array>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
#include <boost/geometry/views/detail/points_view.hpp>
|
||||
#include <boost/geometry/algorithms/assign.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
// NOTE: This is equivalent to the previous implementation with detail::points_view.
|
||||
// Technically this should not be called a view because it owns the elements.
|
||||
// It's also not a borrowed_range because of dangling iterators after the
|
||||
// destruction.
|
||||
// It's a container or more specifically a linestring of some sort, e.g. static_linestring.
|
||||
// NOTE: It would be possible to implement a borrowed_range or a view.
|
||||
// The iterators would have to store copies of points.
|
||||
// Another possibility is to store the original Segment or reference/pointer
|
||||
// to Segment and index. But then the reference would be the value type
|
||||
// so technically they would be InputIterators not RandomAccessIterators.
|
||||
|
||||
|
||||
/*!
|
||||
\brief Makes a segment behave like a linestring or a range
|
||||
@@ -43,37 +58,24 @@ namespace boost { namespace geometry
|
||||
*/
|
||||
template <typename Segment>
|
||||
struct segment_view
|
||||
: public detail::points_view
|
||||
<
|
||||
typename geometry::point_type<Segment>::type,
|
||||
2
|
||||
>
|
||||
{
|
||||
typedef typename geometry::point_type<Segment>::type point_type;
|
||||
using array_t = std::array<typename geometry::point_type<Segment>::type, 2>;
|
||||
|
||||
using iterator = typename array_t::const_iterator;
|
||||
using const_iterator = typename array_t::const_iterator;
|
||||
|
||||
/// Constructor accepting the segment to adapt
|
||||
explicit segment_view(Segment const& segment)
|
||||
: detail::points_view<point_type, 2>(copy_policy(segment))
|
||||
{}
|
||||
|
||||
private :
|
||||
|
||||
class copy_policy
|
||||
{
|
||||
public :
|
||||
inline copy_policy(Segment const& segment)
|
||||
: m_segment(segment)
|
||||
{}
|
||||
geometry::detail::assign_point_from_index<0>(segment, m_array[0]);
|
||||
geometry::detail::assign_point_from_index<1>(segment, m_array[1]);
|
||||
}
|
||||
|
||||
inline void apply(point_type* points) const
|
||||
{
|
||||
geometry::detail::assign_point_from_index<0>(m_segment, points[0]);
|
||||
geometry::detail::assign_point_from_index<1>(m_segment, points[1]);
|
||||
}
|
||||
private :
|
||||
Segment const& m_segment;
|
||||
};
|
||||
const_iterator begin() const noexcept { return m_array.begin(); }
|
||||
const_iterator end() const noexcept { return m_array.end(); }
|
||||
|
||||
private:
|
||||
array_t m_array;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user