Skip to content

Commit

Permalink
Merge branch 'develop' into fix/convex_hull_compare_strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
vissarion authored Jul 5, 2023
2 parents a4923db + 592024e commit 2cda943
Show file tree
Hide file tree
Showing 43 changed files with 255 additions and 163 deletions.
9 changes: 5 additions & 4 deletions include/boost/geometry/algorithms/densify.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Boost.Geometry

// Copyright (c) 2017-2021, Oracle and/or its affiliates.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// Copyright (c) 2017-2021, 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.
Expand Down Expand Up @@ -33,7 +34,7 @@
#include <boost/geometry/strategies/densify/geographic.hpp>
#include <boost/geometry/strategies/densify/spherical.hpp>
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/constexpr.hpp>
#include <boost/geometry/util/range.hpp>


Expand Down Expand Up @@ -102,7 +103,7 @@ struct densify_range
strategy.apply(p0, p1, policy, len);
}

if (BOOST_GEOMETRY_CONDITION(AppendLastPoint))
if BOOST_GEOMETRY_CONSTEXPR (AppendLastPoint)
{
convert_and_push_back(rng_out, *prev); // back(rng)
}
Expand Down Expand Up @@ -130,7 +131,7 @@ struct densify_ring

strategy.apply(p0, p1, policy, len);

if (BOOST_GEOMETRY_CONDITION(IsClosed2))
if BOOST_GEOMETRY_CONSTEXPR (IsClosed2)
{
convert_and_push_back(ring_out, p1);
}
Expand Down
34 changes: 18 additions & 16 deletions include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2022-2023 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2017-2022.
// Modifications copyright (c) 2017-2022 Oracle and/or its affiliates.
Expand Down Expand Up @@ -44,7 +44,7 @@
#include <boost/geometry/strategies/buffer.hpp>
#include <boost/geometry/strategies/side.hpp>

#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/constexpr.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/type_traits.hpp>

Expand Down Expand Up @@ -942,17 +942,17 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
{
boost::ignore_unused(visit_pieces_policy);

typedef detail::buffer::buffered_piece_collection
<
typename geometry::ring_type<GeometryOutput>::type,
Strategies,
DistanceStrategy,
RobustPolicy
> collection_type;
using collection_type = detail::buffer::buffered_piece_collection
<
typename geometry::ring_type<GeometryOutput>::type,
Strategies,
DistanceStrategy,
RobustPolicy
>;
collection_type collection(strategies, distance_strategy, robust_policy);
collection_type const& const_collection = collection;

bool const areal = util::is_areal<GeometryInput>::value;
static constexpr bool areal = util::is_areal<GeometryInput>::value;

dispatch::buffer_inserter
<
Expand All @@ -969,7 +969,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
robust_policy, strategies);

collection.get_turns();
if (BOOST_GEOMETRY_CONDITION(areal))
if BOOST_GEOMETRY_CONSTEXPR (areal)
{
collection.check_turn_in_original();
}
Expand All @@ -989,7 +989,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
// phase 1: turns (after enrichment/clustering)
visit_pieces_policy.apply(const_collection, 1);

if (BOOST_GEOMETRY_CONDITION(areal))
if BOOST_GEOMETRY_CONSTEXPR (areal)
{
collection.deflate_check_turns();
}
Expand All @@ -1001,8 +1001,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
// - the output is counter clockwise
// and avoid reversing twice
bool reverse = distance_strategy.negative() && areal;
if (BOOST_GEOMETRY_CONDITION(
geometry::point_order<GeometryOutput>::value == counterclockwise))
if BOOST_GEOMETRY_CONSTEXPR (geometry::point_order<GeometryOutput>::value == counterclockwise)
{
reverse = ! reverse;
}
Expand All @@ -1011,9 +1010,12 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
collection.reverse();
}

if (BOOST_GEOMETRY_CONDITION(distance_strategy.negative() && areal))
if BOOST_GEOMETRY_CONSTEXPR (areal)
{
collection.discard_nonintersecting_deflated_rings();
if (distance_strategy.negative())
{
collection.discard_nonintersecting_deflated_rings();
}
}

collection.template assign<GeometryOutput>(out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ private :
TiRStrategy const& strategy,
geometry::strategy::buffer::place_on_ring_type place_on_ring, State& state) const
{
return strategy.apply(point, p1, p2, place_on_ring, m_is_convex, state, get_full_ring());
return strategy.apply(point, p1, p2, place_on_ring, m_is_convex, state);
}

template <typename It, typename Box, typename Strategy>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Boost.Geometry

// Copyright (c) 2019-2021, Oracle and/or its affiliates.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// Copyright (c) 2019-2021, 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.
Expand Down Expand Up @@ -334,7 +335,7 @@ namespace detail
template <typename Ring, typename Strategy>
inline geometry::order_selector calculate_point_order(Ring const& ring, Strategy const& strategy)
{
concepts::check<Ring>();
concepts::check<Ring const>();

return dispatch::calculate_point_order<Strategy>::apply(ring, strategy);
}
Expand All @@ -347,7 +348,7 @@ inline geometry::order_selector calculate_point_order(Ring const& ring)
typename geometry::cs_tag<Ring>::type
>::type strategy_type;

concepts::check<Ring>();
concepts::check<Ring const>();

return dispatch::calculate_point_order<strategy_type>::apply(ring, strategy_type());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
Expand Down Expand Up @@ -224,7 +225,7 @@ struct convex_hull<Box, box_tag>
template <typename OutputGeometry, typename Strategy>
static inline void apply(Box const& box,
OutputGeometry& out,
Strategy const& strategy)
Strategy const& )
{
static bool const Close
= geometry::closure<OutputGeometry>::value == closed;
Expand Down
13 changes: 8 additions & 5 deletions include/boost/geometry/algorithms/detail/is_valid/linear.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
Expand Down Expand Up @@ -31,7 +32,7 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/constexpr.hpp>


namespace boost { namespace geometry
Expand Down Expand Up @@ -158,10 +159,12 @@ class is_valid
VisitPolicy& visitor,
Strategy const& strategy)
{
if (BOOST_GEOMETRY_CONDITION(
AllowEmptyMultiGeometries && boost::empty(multilinestring)))
if BOOST_GEOMETRY_CONSTEXPR (AllowEmptyMultiGeometries)
{
return visitor.template apply<no_failure>();
if (boost::empty(multilinestring))
{
return visitor.template apply<no_failure>();
}
}

using per_ls = per_linestring<VisitPolicy, Strategy>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
Expand All @@ -27,7 +28,7 @@
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/constexpr.hpp>
#include <boost/geometry/util/range.hpp>

#include <boost/geometry/geometries/box.hpp>
Expand Down Expand Up @@ -282,10 +283,12 @@ class is_valid_multipolygon
{
using debug_phase = debug_validity_phase<MultiPolygon>;

if (BOOST_GEOMETRY_CONDITION(AllowEmptyMultiGeometries)
&& boost::empty(multipolygon))
if BOOST_GEOMETRY_CONSTEXPR (AllowEmptyMultiGeometries)
{
return visitor.template apply<no_failure>();
if (boost::empty(multipolygon))
{
return visitor.template apply<no_failure>();
}
}

// check validity of all polygons ring
Expand Down
7 changes: 3 additions & 4 deletions include/boost/geometry/algorithms/detail/is_valid/polygon.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.

// 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 Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
Expand Down Expand Up @@ -35,7 +34,7 @@
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/constexpr.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/sequence.hpp>

Expand Down Expand Up @@ -447,7 +446,7 @@ class is_valid_polygon
return false;
}

if (BOOST_GEOMETRY_CONDITION(CheckRingValidityOnly))
if BOOST_GEOMETRY_CONSTEXPR (CheckRingValidityOnly)
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2019-2022.
// Modifications copyright (c) 2019-2022 Oracle and/or its affiliates.
Expand Down Expand Up @@ -165,8 +165,8 @@ private :
if (! cinfo.turn_indices.empty()
&& is_self_cluster(cluster_id, turns, clusters))
{
signed_size_type const index = *cinfo.turn_indices.begin();
if (! check_within<OverlayType>::apply(turns[index],
signed_size_type const first_index = *cinfo.turn_indices.begin();
if (! check_within<OverlayType>::apply(turns[first_index],
geometry0, geometry1,
strategy))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// Copyright (c) 2014-2023, Oracle and/or its affiliates.

// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
Expand Down Expand Up @@ -34,6 +36,8 @@

#include <boost/geometry/policies/compare.hpp>

#include <boost/geometry/util/condition.hpp>


namespace boost { namespace geometry
{
Expand Down Expand Up @@ -257,8 +261,8 @@ struct multipoint_multipoint_point
{
typedef geometry::less<void, -1, Strategy> less_type;

if ( OverlayType != overlay_difference
&& boost::size(multipoint1) > boost::size(multipoint2) )
if (BOOST_GEOMETRY_CONDITION(OverlayType != overlay_difference)
&& boost::size(multipoint1) > boost::size(multipoint2))
{
return multipoint_multipoint_point
<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Boost.Geometry

// Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2022-2023 Adam Wulkiewicz, Lodz, Poland.

// Copyright (c) 2022 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,
Expand All @@ -25,6 +24,7 @@
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/views/detail/geometry_collection_view.hpp>


Expand All @@ -49,18 +49,17 @@ struct aa_handler_wrapper

explicit aa_handler_wrapper(Handler& handler)
: m_handler(handler)
{
m_overwrite_ii = ! handler.template may_update<interior, interior, '2'>();
m_overwrite_ie = ! handler.template may_update<interior, exterior, '2'>();
m_overwrite_ei = ! handler.template may_update<exterior, interior, '2'>();
}
, m_overwrite_ii(! handler.template may_update<interior, interior, '2'>())
, m_overwrite_ie(! handler.template may_update<interior, exterior, '2'>())
, m_overwrite_ei(! handler.template may_update<exterior, interior, '2'>())
{}

template <field F1, field F2, char D>
inline bool may_update() const
{
if ((F1 == interior && F2 == interior && m_overwrite_ii)
|| (F1 == interior && F2 == exterior && m_overwrite_ie)
|| (F1 == exterior && F2 == interior && m_overwrite_ei))
if ((BOOST_GEOMETRY_CONDITION(F1 == interior && F2 == interior) && m_overwrite_ii)
|| (BOOST_GEOMETRY_CONDITION(F1 == interior && F2 == exterior) && m_overwrite_ie)
|| (BOOST_GEOMETRY_CONDITION(F1 == exterior && F2 == interior) && m_overwrite_ei))
{
char const c = m_handler.template get<F1, F2>();
return D > c || c > '9';
Expand All @@ -74,9 +73,9 @@ struct aa_handler_wrapper
template <field F1, field F2, char V>
inline void update()
{
if ((F1 == interior && F2 == interior && m_overwrite_ii)
|| (F1 == interior && F2 == exterior && m_overwrite_ie)
|| (F1 == exterior && F2 == interior && m_overwrite_ei))
if ((BOOST_GEOMETRY_CONDITION(F1 == interior && F2 == interior) && m_overwrite_ii)
|| (BOOST_GEOMETRY_CONDITION(F1 == interior && F2 == exterior) && m_overwrite_ie)
|| (BOOST_GEOMETRY_CONDITION(F1 == exterior && F2 == interior) && m_overwrite_ei))
{
// NOTE: Other handlers first check for potential interruption
// and only after that checks update condition.
Expand All @@ -97,9 +96,9 @@ struct aa_handler_wrapper

private:
Handler & m_handler;
bool m_overwrite_ii = false;
bool m_overwrite_ie = false;
bool m_overwrite_ei = false;
bool const m_overwrite_ii;
bool const m_overwrite_ie;
bool const m_overwrite_ei;
};


Expand Down
Loading

0 comments on commit 2cda943

Please sign in to comment.