Skip to content

Commit

Permalink
[index] Fix and improve rtree experimental features
Browse files Browse the repository at this point in the history
Fix access specifier preventing use of experimental iterators.
Allow more granular control over enabled experimental features.
  • Loading branch information
awulkiew committed Jul 19, 2022
1 parent 070e351 commit 379f0c3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
12 changes: 9 additions & 3 deletions include/boost/geometry/index/distance_predicates.hpp
Expand Up @@ -2,7 +2,7 @@
//
// Spatial index distance predicates, calculators and checkers used in nearest neighbor query
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2011-2022 Adam Wulkiewicz, Lodz, Poland.
//
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Expand All @@ -11,6 +11,12 @@
#ifndef BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP
#define BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES
#endif
#endif

#include <boost/geometry/index/detail/distance_predicates.hpp>

/*!
Expand All @@ -21,7 +27,7 @@ namespace boost { namespace geometry { namespace index {

// relations generators

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES

/*!
\brief Generate to_nearest() relationship.
Expand Down Expand Up @@ -91,7 +97,7 @@ detail::to_furthest<T> to_furthest(T const& v)
return detail::to_furthest<T>(v);
}

#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES

// distance predicates generators

Expand Down
16 changes: 11 additions & 5 deletions include/boost/geometry/index/predicates.hpp
Expand Up @@ -2,7 +2,7 @@
//
// Spatial query predicates
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2011-2022 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 Oracle and/or its affiliates.
Expand All @@ -15,6 +15,12 @@
#ifndef BOOST_GEOMETRY_INDEX_PREDICATES_HPP
#define BOOST_GEOMETRY_INDEX_PREDICATES_HPP

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES
#endif
#endif

#include <boost/geometry/index/detail/predicates.hpp>
#include <boost/geometry/util/tuples.hpp>

Expand Down Expand Up @@ -212,7 +218,7 @@ overlaps(Geometry const& g)
>(g);
}

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES

/*!
\brief Generate \c touches() predicate.
Expand Down Expand Up @@ -240,7 +246,7 @@ touches(Geometry const& g)
>(g);
}

#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES

/*!
\brief Generate \c within() predicate.
Expand Down Expand Up @@ -343,7 +349,7 @@ nearest(Geometry const& geometry, std::size_t k)
return detail::predicates::nearest<Geometry>(geometry, k);
}

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES

/*!
\brief Generate path() predicate.
Expand Down Expand Up @@ -373,7 +379,7 @@ path(SegmentOrLinestring const& linestring, std::size_t k)
return detail::predicates::path<SegmentOrLinestring>(linestring, k);
}

#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES

namespace detail { namespace predicates {

Expand Down
18 changes: 14 additions & 4 deletions include/boost/geometry/index/rtree.hpp
Expand Up @@ -3,7 +3,7 @@
// R-tree implementation
//
// Copyright (c) 2008 Federico J. Fernandez.
// Copyright (c) 2011-2019 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2011-2022 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2020 Caian Benedicto, Campinas, Brazil.
//
// This file was modified by Oracle on 2019-2021.
Expand Down Expand Up @@ -90,7 +90,15 @@
#include <boost/geometry/index/detail/rtree/query_iterators.hpp>

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
// serialization
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_SERIALIZATION
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_SERIALIZATION
#endif
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_ITERATORS
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_ITERATORS
#endif
#endif

#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_SERIALIZATION
#include <boost/geometry/index/detail/serialization.hpp>
#endif

Expand Down Expand Up @@ -312,7 +320,7 @@ class rtree
typedef typename members_holder::allocator_traits_type allocator_traits_type;

friend class detail::rtree::utilities::view<rtree>;
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_SERIALIZATION
friend class detail::rtree::private_view<rtree>;
friend class detail::rtree::const_private_view<rtree>;
#endif
Expand Down Expand Up @@ -1184,7 +1192,9 @@ class rtree
detail::rtree::iterators::distance_query_iterator<members_holder, Predicates>
>;

#ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_ITERATORS
public:
#else
private:
#endif
/*!
Expand Down

0 comments on commit 379f0c3

Please sign in to comment.