diff --git a/include/boost/geometry/core/config.hpp b/include/boost/geometry/core/config.hpp index a96c47c93..855735d7b 100644 --- a/include/boost/geometry/core/config.hpp +++ b/include/boost/geometry/core/config.hpp @@ -15,4 +15,18 @@ #include +#if defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE) \ + && defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST) +#error "Both BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE" \ + " and BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST are defined." \ + " Only one of them should be defined." +#endif + +// Define default side strategy, if not defined by the user. +// Until Boost 1.88.0, the default strategy is side_by_triangle. +#if ! defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE) \ + && ! defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST) +#define BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE +#endif + #endif // BOOST_GEOMETRY_CORE_CONFIG_HPP diff --git a/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp b/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp index bf8c0d64c..b432aeb31 100644 --- a/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp +++ b/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp @@ -243,7 +243,7 @@ private: }; #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS - +#if defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE) namespace services { @@ -253,9 +253,9 @@ struct default_strategy using type = side_by_triangle; }; -} - +} // namespace services #endif +#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS }} // namespace strategy::side diff --git a/include/boost/geometry/strategy/cartesian/side_robust.hpp b/include/boost/geometry/strategy/cartesian/side_robust.hpp index 1483cd7e9..d76098f5b 100644 --- a/include/boost/geometry/strategy/cartesian/side_robust.hpp +++ b/include/boost/geometry/strategy/cartesian/side_robust.hpp @@ -178,6 +178,21 @@ public: }; +#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS +#if defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST) +namespace services +{ + +template +struct default_strategy +{ + using type = side_robust; +}; + +} // namespace services +#endif +#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS + }} // namespace strategy::side }} // namespace boost::geometry diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp index 0dc0ab0b6..cc1d97021 100644 --- a/test/geometry_test_common.hpp +++ b/test/geometry_test_common.hpp @@ -20,6 +20,7 @@ #define GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP #include +#include // Determine debug/release mode // (it would be convenient if Boost.Config or Boost.Test would define this) @@ -94,6 +95,7 @@ #include #include #include +#include namespace bg = boost::geometry; @@ -210,6 +212,13 @@ inline void BoostGeometryWriteTestConfiguration() std::cout << " - Including failing test cases" << std::endl; #endif std::cout << " - Default test type: " << string_from_type::name() << std::endl; + + using side_strategy = typename bg::strategy::side::services::default_strategy + < + bg::cartesian_tag + >::type; + std::cout << " - Side strategy: " << boost::core::demangle(typeid(side_strategy).name()) << std::endl; + std::cout << std::endl; }