mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
fix: add closest_ponts and centroid getters to higher level umbrella strategies
This commit is contained in:
parent
225c4f2346
commit
3bedb43f1d
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -14,6 +16,8 @@
|
|||||||
#include <boost/geometry/strategies/area/cartesian.hpp>
|
#include <boost/geometry/strategies/area/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/azimuth/cartesian.hpp>
|
#include <boost/geometry/strategies/azimuth/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/buffer/cartesian.hpp>
|
#include <boost/geometry/strategies/buffer/cartesian.hpp>
|
||||||
|
#include <boost/geometry/strategies/centroid/cartesian.hpp>
|
||||||
|
#include <boost/geometry/strategies/closest_points/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/convex_hull/cartesian.hpp>
|
#include <boost/geometry/strategies/convex_hull/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/distance/cartesian.hpp>
|
#include <boost/geometry/strategies/distance/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/envelope/cartesian.hpp>
|
#include <boost/geometry/strategies/envelope/cartesian.hpp>
|
||||||
@ -36,7 +40,8 @@ namespace strategies
|
|||||||
template <typename CalculationType = void>
|
template <typename CalculationType = void>
|
||||||
class cartesian
|
class cartesian
|
||||||
// derived from the umbrella strategy defining the most strategies
|
// derived from the umbrella strategy defining the most strategies
|
||||||
: public strategies::index::cartesian<CalculationType>
|
: public strategies::closest_points::cartesian<CalculationType>
|
||||||
|
, public strategies::centroid::detail::cartesian<CalculationType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2021, Oracle and/or its affiliates.
|
// Copyright (c) 2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -27,9 +29,12 @@ namespace boost { namespace geometry
|
|||||||
namespace strategies { namespace centroid
|
namespace strategies { namespace centroid
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_NO_DETAIL
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
template <typename CalculationType = void>
|
template <typename CalculationType = void>
|
||||||
struct cartesian
|
struct cartesian
|
||||||
: public strategies::detail::cartesian_base
|
|
||||||
{
|
{
|
||||||
template <typename Geometry>
|
template <typename Geometry>
|
||||||
static auto centroid(Geometry const&,
|
static auto centroid(Geometry const&,
|
||||||
@ -77,6 +82,17 @@ struct cartesian
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
#endif // DOXYGEN_NO_DETAIL
|
||||||
|
|
||||||
|
|
||||||
|
template <typename CalculationType = void>
|
||||||
|
struct cartesian
|
||||||
|
: public strategies::detail::cartesian_base
|
||||||
|
, public strategies::centroid::detail::cartesian<CalculationType>
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
namespace services
|
namespace services
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2021, Oracle and/or its affiliates.
|
// Copyright (c) 2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -22,24 +24,13 @@ namespace boost { namespace geometry
|
|||||||
namespace strategies { namespace centroid
|
namespace strategies { namespace centroid
|
||||||
{
|
{
|
||||||
|
|
||||||
template
|
#ifndef DOXYGEN_NO_DETAIL
|
||||||
<
|
namespace detail
|
||||||
typename FormulaPolicy = strategy::andoyer,
|
|
||||||
typename Spheroid = srs::spheroid<double>,
|
|
||||||
typename CalculationType = void
|
|
||||||
>
|
|
||||||
class geographic
|
|
||||||
: public strategies::detail::geographic_base<Spheroid>
|
|
||||||
{
|
{
|
||||||
using base_t = strategies::detail::geographic_base<Spheroid>;
|
|
||||||
|
|
||||||
|
class geographic
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
geographic() = default;
|
|
||||||
|
|
||||||
explicit geographic(Spheroid const& spheroid)
|
|
||||||
: base_t(spheroid)
|
|
||||||
{}
|
|
||||||
|
|
||||||
// TODO: Box and Segment should have proper strategies.
|
// TODO: Box and Segment should have proper strategies.
|
||||||
template <typename Geometry, typename Point>
|
template <typename Geometry, typename Point>
|
||||||
static auto centroid(Geometry const&, Point const&,
|
static auto centroid(Geometry const&, Point const&,
|
||||||
@ -53,6 +44,32 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
#endif // DOXYGEN_NO_DETAIL
|
||||||
|
|
||||||
|
|
||||||
|
template
|
||||||
|
<
|
||||||
|
typename FormulaPolicy = strategy::andoyer,
|
||||||
|
typename Spheroid = srs::spheroid<double>,
|
||||||
|
typename CalculationType = void
|
||||||
|
>
|
||||||
|
class geographic
|
||||||
|
: public strategies::detail::geographic_base<Spheroid>
|
||||||
|
, public strategies::centroid::detail::geographic
|
||||||
|
{
|
||||||
|
using base_t = strategies::detail::geographic_base<Spheroid>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
geographic() = default;
|
||||||
|
|
||||||
|
explicit geographic(Spheroid const& spheroid)
|
||||||
|
: base_t(spheroid)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace services
|
namespace services
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2021, Oracle and/or its affiliates.
|
// Copyright (c) 2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -22,18 +24,13 @@ namespace boost { namespace geometry
|
|||||||
namespace strategies { namespace centroid
|
namespace strategies { namespace centroid
|
||||||
{
|
{
|
||||||
|
|
||||||
template
|
#ifndef DOXYGEN_NO_DETAIL
|
||||||
<
|
namespace detail
|
||||||
typename CalculationType = void
|
|
||||||
>
|
|
||||||
class spherical
|
|
||||||
: public strategies::detail::spherical_base<void>
|
|
||||||
{
|
{
|
||||||
using base_t = strategies::detail::spherical_base<void>;
|
|
||||||
|
|
||||||
|
class spherical
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
spherical() = default;
|
|
||||||
|
|
||||||
// TODO: Box and Segment should have proper strategies.
|
// TODO: Box and Segment should have proper strategies.
|
||||||
template <typename Geometry, typename Point>
|
template <typename Geometry, typename Point>
|
||||||
static auto centroid(Geometry const&, Point const&,
|
static auto centroid(Geometry const&, Point const&,
|
||||||
@ -48,6 +45,20 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
#endif // DOXYGEN_NO_DETAIL
|
||||||
|
|
||||||
|
|
||||||
|
template <typename CalculationType = void>
|
||||||
|
class spherical
|
||||||
|
: public strategies::detail::spherical_base<void>
|
||||||
|
, public strategies::centroid::detail::spherical
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
spherical() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace services
|
namespace services
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -14,6 +16,8 @@
|
|||||||
#include <boost/geometry/strategies/area/geographic.hpp>
|
#include <boost/geometry/strategies/area/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/azimuth/geographic.hpp>
|
#include <boost/geometry/strategies/azimuth/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/buffer/geographic.hpp>
|
#include <boost/geometry/strategies/buffer/geographic.hpp>
|
||||||
|
#include <boost/geometry/strategies/centroid/geographic.hpp>
|
||||||
|
#include <boost/geometry/strategies/closest_points/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/convex_hull/geographic.hpp>
|
#include <boost/geometry/strategies/convex_hull/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/distance/geographic.hpp>
|
#include <boost/geometry/strategies/distance/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/envelope/geographic.hpp>
|
#include <boost/geometry/strategies/envelope/geographic.hpp>
|
||||||
@ -41,9 +45,10 @@ template
|
|||||||
>
|
>
|
||||||
class geographic
|
class geographic
|
||||||
// derived from the umbrella strategy defining the most strategies
|
// derived from the umbrella strategy defining the most strategies
|
||||||
: public index::geographic<FormulaPolicy, Spheroid, CalculationType>
|
: public strategies::closest_points::geographic<FormulaPolicy, Spheroid, CalculationType>
|
||||||
|
, public strategies::centroid::detail::geographic
|
||||||
{
|
{
|
||||||
using base_t = index::geographic<FormulaPolicy, Spheroid, CalculationType>;
|
using base_t = strategies::closest_points::geographic<FormulaPolicy, Spheroid, CalculationType>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
geographic() = default;
|
geographic() = default;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -11,17 +13,18 @@
|
|||||||
#define BOOST_GEOMETRY_STRATEGIES_INDEX_CARTESIAN_HPP
|
#define BOOST_GEOMETRY_STRATEGIES_INDEX_CARTESIAN_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/geometry/strategies/centroid/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/distance/cartesian.hpp>
|
#include <boost/geometry/strategies/distance/cartesian.hpp>
|
||||||
#include <boost/geometry/strategies/index/services.hpp>
|
#include <boost/geometry/strategies/index/services.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace boost { namespace geometry { namespace strategies { namespace index
|
namespace boost { namespace geometry { namespace strategies { namespace index
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename CalculationType = void>
|
template <typename CalculationType = void>
|
||||||
class cartesian
|
class cartesian
|
||||||
: public distance::cartesian<CalculationType>
|
: public distance::cartesian<CalculationType>
|
||||||
|
, public strategies::centroid::detail::cartesian<CalculationType>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -11,6 +13,7 @@
|
|||||||
#define BOOST_GEOMETRY_STRATEGIES_INDEX_GEOGRAPHIC_HPP
|
#define BOOST_GEOMETRY_STRATEGIES_INDEX_GEOGRAPHIC_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/geometry/strategies/centroid/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/distance/geographic.hpp>
|
#include <boost/geometry/strategies/distance/geographic.hpp>
|
||||||
#include <boost/geometry/strategies/index/services.hpp>
|
#include <boost/geometry/strategies/index/services.hpp>
|
||||||
|
|
||||||
@ -26,6 +29,7 @@ template
|
|||||||
>
|
>
|
||||||
class geographic
|
class geographic
|
||||||
: public distance::geographic<FormulaPolicy, Spheroid, CalculationType>
|
: public distance::geographic<FormulaPolicy, Spheroid, CalculationType>
|
||||||
|
, public strategies::centroid::detail::geographic
|
||||||
{
|
{
|
||||||
typedef distance::geographic<FormulaPolicy, Spheroid, CalculationType> base_t;
|
typedef distance::geographic<FormulaPolicy, Spheroid, CalculationType> base_t;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -11,6 +13,7 @@
|
|||||||
#define BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP
|
#define BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/geometry/strategies/centroid/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/distance/spherical.hpp>
|
#include <boost/geometry/strategies/distance/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/index/services.hpp>
|
#include <boost/geometry/strategies/index/services.hpp>
|
||||||
|
|
||||||
@ -28,6 +31,7 @@ namespace detail
|
|||||||
template <typename RadiusTypeOrSphere, typename CalculationType>
|
template <typename RadiusTypeOrSphere, typename CalculationType>
|
||||||
class spherical
|
class spherical
|
||||||
: public strategies::distance::detail::spherical<RadiusTypeOrSphere, CalculationType>
|
: public strategies::distance::detail::spherical<RadiusTypeOrSphere, CalculationType>
|
||||||
|
, public strategies::centroid::detail::spherical
|
||||||
{
|
{
|
||||||
using base_t = strategies::distance::detail::spherical<RadiusTypeOrSphere, CalculationType>;
|
using base_t = strategies::distance::detail::spherical<RadiusTypeOrSphere, CalculationType>;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
|
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
|
||||||
|
|
||||||
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
// Copyright (c) 2020-2021, Oracle and/or its affiliates.
|
||||||
|
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -14,6 +16,8 @@
|
|||||||
#include <boost/geometry/strategies/area/spherical.hpp>
|
#include <boost/geometry/strategies/area/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/azimuth/spherical.hpp>
|
#include <boost/geometry/strategies/azimuth/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/buffer/spherical.hpp>
|
#include <boost/geometry/strategies/buffer/spherical.hpp>
|
||||||
|
#include <boost/geometry/strategies/centroid/spherical.hpp>
|
||||||
|
#include <boost/geometry/strategies/closest_points/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/convex_hull/spherical.hpp>
|
#include <boost/geometry/strategies/convex_hull/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/distance/spherical.hpp>
|
#include <boost/geometry/strategies/distance/spherical.hpp>
|
||||||
#include <boost/geometry/strategies/envelope/spherical.hpp>
|
#include <boost/geometry/strategies/envelope/spherical.hpp>
|
||||||
@ -40,9 +44,10 @@ template
|
|||||||
>
|
>
|
||||||
class spherical
|
class spherical
|
||||||
// derived from the umbrella strategy defining the most strategies
|
// derived from the umbrella strategy defining the most strategies
|
||||||
: public strategies::index::detail::spherical<RadiusTypeOrSphere, CalculationType>
|
: public strategies::closest_points::spherical<RadiusTypeOrSphere, CalculationType>
|
||||||
|
, public strategies::centroid::detail::spherical
|
||||||
{
|
{
|
||||||
using base_t = strategies::index::detail::spherical<RadiusTypeOrSphere, CalculationType>;
|
using base_t = strategies::closest_points::spherical<RadiusTypeOrSphere, CalculationType>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
spherical() = default;
|
spherical() = default;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user