update boost
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user