mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 20:28:09 +00:00
Added thirdparty: boost library
This commit is contained in:
+123
@@ -0,0 +1,123 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 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.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_STRATEGIES_CENTROID_CARTESIAN_HPP
|
||||
#define BOOST_GEOMETRY_STRATEGIES_CENTROID_CARTESIAN_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/strategies/cartesian/centroid_average.hpp>
|
||||
#include <boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp>
|
||||
#include <boost/geometry/strategies/cartesian/centroid_weighted_length.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/detail.hpp>
|
||||
#include <boost/geometry/strategies/centroid/services.hpp>
|
||||
|
||||
#include <boost/geometry/util/type_traits.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace strategies { namespace centroid
|
||||
{
|
||||
|
||||
template <typename CalculationType = void>
|
||||
struct cartesian
|
||||
: public strategies::detail::cartesian_base
|
||||
{
|
||||
template <typename Geometry>
|
||||
static auto centroid(Geometry const&,
|
||||
std::enable_if_t
|
||||
<
|
||||
util::is_pointlike<Geometry>::value
|
||||
> * = nullptr)
|
||||
{
|
||||
return strategy::centroid::average<>();
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
static auto centroid(Geometry const&,
|
||||
std::enable_if_t
|
||||
<
|
||||
util::is_polylinear<Geometry>::value
|
||||
> * = nullptr)
|
||||
{
|
||||
return strategy::centroid::weighted_length<void, void, CalculationType>();
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
static auto centroid(Geometry const&,
|
||||
std::enable_if_t
|
||||
<
|
||||
util::is_polygonal<Geometry>::value
|
||||
// TODO: This condition was used for the legacy default strategy
|
||||
// && geometry::dimension<Geometry>::value == 2
|
||||
> * = nullptr)
|
||||
{
|
||||
return strategy::centroid::bashein_detmer<void, void, CalculationType>();
|
||||
}
|
||||
|
||||
// TODO: Box and Segment should have proper strategies.
|
||||
template <typename Geometry, typename Point>
|
||||
static auto centroid(Geometry const&, Point const&,
|
||||
std::enable_if_t
|
||||
<
|
||||
util::is_segment<Geometry>::value
|
||||
|| util::is_box<Geometry>::value
|
||||
> * = nullptr)
|
||||
{
|
||||
return strategy::centroid::not_applicable_strategy();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace services
|
||||
{
|
||||
|
||||
template <typename Geometry>
|
||||
struct default_strategy<Geometry, cartesian_tag>
|
||||
{
|
||||
using type = strategies::centroid::cartesian<>;
|
||||
};
|
||||
|
||||
|
||||
template <typename PC, typename PG>
|
||||
struct strategy_converter<strategy::centroid::average<PC, PG> >
|
||||
{
|
||||
static auto get(strategy::centroid::average<PC, PG> const&)
|
||||
{
|
||||
return strategies::centroid::cartesian<>();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PC, typename PG>
|
||||
struct strategy_converter<strategy::centroid::weighted_length<PC, PG> >
|
||||
{
|
||||
static auto get(strategy::centroid::weighted_length<PC, PG> const&)
|
||||
{
|
||||
return strategies::centroid::cartesian<>();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PC, typename PG, typename CT>
|
||||
struct strategy_converter<strategy::centroid::bashein_detmer<PC, PG, CT> >
|
||||
{
|
||||
static auto get(strategy::centroid::bashein_detmer<PC, PG, CT> const&)
|
||||
{
|
||||
return strategies::centroid::cartesian<CT>();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace services
|
||||
|
||||
}} // namespace strategies::centroid
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_STRATEGIES_CENTROID_CARTESIAN_HPP
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 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.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_STRATEGIES_CENTROID_GEOGRAPHIC_HPP
|
||||
#define BOOST_GEOMETRY_STRATEGIES_CENTROID_GEOGRAPHIC_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/strategies/detail.hpp>
|
||||
#include <boost/geometry/strategies/centroid.hpp>
|
||||
#include <boost/geometry/strategies/centroid/services.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace strategies { namespace centroid
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
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>;
|
||||
|
||||
public:
|
||||
geographic() = default;
|
||||
|
||||
explicit geographic(Spheroid const& spheroid)
|
||||
: base_t(spheroid)
|
||||
{}
|
||||
|
||||
// TODO: Box and Segment should have proper strategies.
|
||||
template <typename Geometry, typename Point>
|
||||
static auto centroid(Geometry const&, Point const&,
|
||||
std::enable_if_t
|
||||
<
|
||||
util::is_segment<Geometry>::value
|
||||
|| util::is_box<Geometry>::value
|
||||
> * = nullptr)
|
||||
{
|
||||
return strategy::centroid::not_applicable_strategy();
|
||||
}
|
||||
};
|
||||
|
||||
namespace services
|
||||
{
|
||||
|
||||
template <typename Geometry>
|
||||
struct default_strategy<Geometry, geographic_tag>
|
||||
{
|
||||
using type = strategies::centroid::geographic<>;
|
||||
};
|
||||
|
||||
} // namespace services
|
||||
|
||||
}} // namespace strategies::centroid
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_STRATEGIES_CENTROID_GEOGRAPHIC_HPP
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 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.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_STRATEGIES_CENTROID_SERVICES_HPP
|
||||
#define BOOST_GEOMETRY_STRATEGIES_CENTROID_SERVICES_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
#include <boost/geometry/core/static_assert.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace strategies { namespace centroid
|
||||
{
|
||||
|
||||
namespace services
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
typename CSTag = typename geometry::cs_tag<Geometry>::type
|
||||
>
|
||||
struct default_strategy
|
||||
{
|
||||
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
|
||||
"Not implemented for this Geometry's coordinate systems.",
|
||||
Geometry, CSTag);
|
||||
};
|
||||
|
||||
template <typename Strategy>
|
||||
struct strategy_converter
|
||||
{
|
||||
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
|
||||
"Not implemented for this Strategy.",
|
||||
Strategy);
|
||||
};
|
||||
|
||||
|
||||
} // namespace services
|
||||
|
||||
}} // namespace strategies::centroid
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_STRATEGIES_CENTROID_SERVICES_HPP
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 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.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_STRATEGIES_CENTROID_SPHERICAL_HPP
|
||||
#define BOOST_GEOMETRY_STRATEGIES_CENTROID_SPHERICAL_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/strategies/detail.hpp>
|
||||
#include <boost/geometry/strategies/centroid.hpp>
|
||||
#include <boost/geometry/strategies/centroid/services.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace strategies { namespace centroid
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
typename CalculationType = void
|
||||
>
|
||||
class spherical
|
||||
: public strategies::detail::spherical_base<void>
|
||||
{
|
||||
using base_t = strategies::detail::spherical_base<void>;
|
||||
|
||||
public:
|
||||
spherical() = default;
|
||||
|
||||
// TODO: Box and Segment should have proper strategies.
|
||||
template <typename Geometry, typename Point>
|
||||
static auto centroid(Geometry const&, Point const&,
|
||||
std::enable_if_t
|
||||
<
|
||||
util::is_segment<Geometry>::value
|
||||
|| util::is_box<Geometry>::value
|
||||
> * = nullptr)
|
||||
{
|
||||
return strategy::centroid::not_applicable_strategy();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace services
|
||||
{
|
||||
|
||||
template <typename Geometry>
|
||||
struct default_strategy<Geometry, spherical_equatorial_tag>
|
||||
{
|
||||
using type = strategies::centroid::spherical<>;
|
||||
};
|
||||
|
||||
} // namespace services
|
||||
|
||||
}} // namespace strategies::centroid
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_STRATEGIES_CENTROID_SPHERICAL_HPP
|
||||
Reference in New Issue
Block a user