feat: use tag_cast_t more and extract primary_single_tag

This commit is contained in:
Barend Gehrels 2024-10-07 20:03:28 +02:00
parent 8ab8cb098d
commit 8d2d399746
49 changed files with 214 additions and 248 deletions

View File

@ -40,6 +40,7 @@
#include <boost/geometry/core/closure.hpp> #include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/point_order.hpp> #include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>

View File

@ -37,6 +37,7 @@
#include <boost/geometry/core/closure.hpp> #include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/exterior_ring.hpp> #include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp> #include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/geometries/linestring.hpp> #include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/ring.hpp> #include <boost/geometry/geometries/ring.hpp>
@ -177,8 +178,7 @@ struct buffer_range
output_point_type const& p1, output_point_type const& p1,
output_point_type const& p2) output_point_type const& p2)
{ {
typedef typename cs_tag<output_point_type>::type cs_tag; return direction_code<cs_tag_t<output_point_type>>(p0, p1, p2) == 1;
return direction_code<cs_tag>(p0, p1, p2) == 1;
} }
template <typename Strategies> template <typename Strategies>
@ -929,11 +929,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
dispatch::buffer_inserter dispatch::buffer_inserter
< <
typename tag_cast tag_cast_t<tag_t<GeometryInput>, multi_tag>,
<
typename tag<GeometryInput>::type,
multi_tag
>::type,
GeometryInput, GeometryInput,
GeometryOutput GeometryOutput
>::apply(geometry_input, collection, >::apply(geometry_input, collection,

View File

@ -45,13 +45,12 @@ namespace detail { namespace centroid
// cartesian. But if it was needed then one should translate using // cartesian. But if it was needed then one should translate using
// CS-specific technique, e.g. in spherical/geographic a translation // CS-specific technique, e.g. in spherical/geographic a translation
// vector should contain coordinates being multiplies of 2PI or 360 deg. // vector should contain coordinates being multiplies of 2PI or 360 deg.
template <typename Geometry, template
typename CastedTag = typename tag_cast <
< typename Geometry,
typename tag<Geometry>::type, typename CastedTag = tag_cast_t<tag_t<Geometry>, areal_tag>,
areal_tag typename CSTag = cs_tag_t<Geometry>
>::type, >
typename CSTag = typename cs_tag<Geometry>::type>
struct translating_transformer struct translating_transformer
{ {
typedef typename geometry::point_type<Geometry>::type point_type; typedef typename geometry::point_type<Geometry>::type point_type;

View File

@ -61,8 +61,8 @@ namespace detail { namespace disjoint
{ {
template <typename Geometry1, typename Geometry2, template <typename Geometry1, typename Geometry2,
typename Tag1 = typename tag<Geometry1>::type, typename Tag1 = tag_t<Geometry1>,
typename Tag1OrMulti = typename tag_cast<Tag1, multi_tag>::type> typename Tag1OrMulti = tag_cast_t<Tag1, multi_tag>>
struct disjoint_no_intersections_policy struct disjoint_no_intersections_policy
{ {
/*! /*!

View File

@ -235,7 +235,7 @@ struct envelope_range_of_boxes
static const bool is_equatorial = ! std::is_same static const bool is_equatorial = ! std::is_same
< <
typename cs_tag<box_type>::type, cs_tag_t<box_type>,
spherical_polar_tag spherical_polar_tag
>::value; >::value;

View File

@ -334,7 +334,7 @@ private:
// Default version (cartesian) // Default version (cartesian)
template <typename Box, typename Collection, typename CSTag = typename cs_tag<Box>::type> template <typename Box, typename Collection, typename CSTag = cs_tag_t<Box>>
struct box_collect_vectors struct box_collect_vectors
{ {
// Calculate on coordinate type, but if it is integer, // Calculate on coordinate type, but if it is integer,

View File

@ -49,10 +49,10 @@ template
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename Tag1 = typename tag<Geometry1>::type, typename Tag1 = tag_t<Geometry1>,
typename Tag2 = typename tag<Geometry2>::type, typename Tag2 = tag_t<Geometry2>,
typename CastedTag1 = typename tag_cast<Tag1, pointlike_tag, linear_tag, areal_tag>::type, typename CastedTag1 = tag_cast_t<Tag1, pointlike_tag, linear_tag, areal_tag>,
typename CastedTag2 = typename tag_cast<Tag2, pointlike_tag, linear_tag, areal_tag>::type, typename CastedTag2 = tag_cast_t<Tag2, pointlike_tag, linear_tag, areal_tag>,
std::size_t DimensionCount = dimension<Geometry1>::type::value, std::size_t DimensionCount = dimension<Geometry1>::type::value,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
> >

View File

@ -546,10 +546,10 @@ inline bool extreme_points(Geometry const& geometry,
Extremes& extremes, Extremes& extremes,
Intruders& intruders) Intruders& intruders)
{ {
typedef typename strategy::side::services::default_strategy using strategy_type = typename strategy::side::services::default_strategy
< <
typename cs_tag<Geometry>::type cs_tag_t<Geometry>
>::type strategy_type; >::type;
return geometry::extreme_points<Edge>(geometry,extremes, intruders, strategy_type()); return geometry::extreme_points<Edge>(geometry,extremes, intruders, strategy_type());
} }

View File

@ -29,7 +29,6 @@
#include <boost/geometry/core/static_assert.hpp> #include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/type_traits.hpp> #include <boost/geometry/util/type_traits.hpp>

View File

@ -45,6 +45,7 @@
#include <boost/geometry/core/interior_rings.hpp> #include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp> #include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/core/ring_type.hpp> #include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/box.hpp>
@ -811,7 +812,7 @@ struct get_turns_multi_polygon_cs
template <typename Geometry> template <typename Geometry>
struct topological_tag_base struct topological_tag_base
{ {
typedef typename tag_cast<typename tag<Geometry>::type, pointlike_tag, linear_tag, areal_tag>::type type; using type = tag_cast_t<tag_t<Geometry>, pointlike_tag, linear_tag, areal_tag>;
}; };
template <typename Geometry1, typename Geometry2, typename AssignPolicy, template <typename Geometry1, typename Geometry2, typename AssignPolicy,

View File

@ -42,6 +42,7 @@
#include <boost/geometry/core/point_order.hpp> #include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp> #include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/core/static_assert.hpp> #include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>
@ -504,13 +505,13 @@ template
bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value, bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value, bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
// tag dispatching: // tag dispatching:
typename TagIn1 = typename geometry::tag<Geometry1>::type, typename TagIn1 = tag_t<Geometry1>,
typename TagIn2 = typename geometry::tag<Geometry2>::type, typename TagIn2 = tag_t<Geometry2>,
typename TagOut = typename detail::setop_insert_output_tag<GeometryOut>::type, typename TagOut = typename detail::setop_insert_output_tag<GeometryOut>::type,
// metafunction finetuning helpers: // metafunction finetuning helpers:
typename CastedTagIn1 = typename geometry::tag_cast<TagIn1, areal_tag, linear_tag, pointlike_tag>::type, typename CastedTagIn1 = tag_cast_t<TagIn1, areal_tag, linear_tag, pointlike_tag>,
typename CastedTagIn2 = typename geometry::tag_cast<TagIn2, areal_tag, linear_tag, pointlike_tag>::type, typename CastedTagIn2 = tag_cast_t<TagIn2, areal_tag, linear_tag, pointlike_tag>,
typename CastedTagOut = typename geometry::tag_cast<TagOut, areal_tag, linear_tag, pointlike_tag>::type typename CastedTagOut = tag_cast_t<TagOut, areal_tag, linear_tag, pointlike_tag>
> >
struct intersection_insert struct intersection_insert
{ {
@ -1064,7 +1065,7 @@ struct intersection_insert
> : detail_dispatch::overlay::pointlike_linear_point > : detail_dispatch::overlay::pointlike_linear_point
< <
Point, Linear, PointOut, OverlayType, Point, Linear, PointOut, OverlayType,
point_tag, typename tag_cast<Tag, segment_tag, linear_tag>::type point_tag, tag_cast_t<Tag, segment_tag, linear_tag>
> >
{}; {};
@ -1086,7 +1087,7 @@ struct intersection_insert
< <
MultiPoint, Linear, PointOut, OverlayType, MultiPoint, Linear, PointOut, OverlayType,
multi_point_tag, multi_point_tag,
typename tag_cast<Tag, segment_tag, linear_tag>::type tag_cast_t<Tag, segment_tag, linear_tag>
> >
{}; {};

View File

@ -16,6 +16,7 @@
#include <boost/geometry/core/access.hpp> #include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_type.hpp> #include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/tag_cast.hpp>
// For spherical/geographic longitudes covered_by point/box // For spherical/geographic longitudes covered_by point/box
#include <boost/geometry/strategies/cartesian/point_in_box.hpp> #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
@ -36,11 +37,7 @@ template
< <
std::size_t Dimension, std::size_t Dimension,
typename Geometry, typename Geometry,
typename CastedCSTag = typename tag_cast typename CastedCSTag = tag_cast_t<cs_tag_t<Geometry>, spherical_tag>
<
typename cs_tag<Geometry>::type,
spherical_tag
>::type
> >
struct preceding_check struct preceding_check
{ {

View File

@ -46,6 +46,7 @@
#include <boost/geometry/core/exterior_ring.hpp> #include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/point_order.hpp> #include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/static_assert.hpp> #include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>
@ -148,11 +149,7 @@ template
typename DimensionVector, typename DimensionVector,
std::size_t Index, std::size_t Index,
std::size_t Count, std::size_t Count,
typename CastedCSTag = typename tag_cast typename CastedCSTag = tag_cast_t<cs_tag_t<Point>, spherical_tag>
<
typename cs_tag<Point>::type,
spherical_tag
>::type
> >
struct get_direction_loop struct get_direction_loop
{ {
@ -497,14 +494,14 @@ struct sectionalize_part
// In cartesian this is envelope of previous point expanded with current point // In cartesian this is envelope of previous point expanded with current point
// in non-cartesian this is envelope of a segment // in non-cartesian this is envelope of a segment
box_first_in_section<typename cs_tag<point_type>::type> box_first_in_section<cs_tag_t<point_type>>
::apply(section.bounding_box, previous_point, current_point, strategy); ::apply(section.bounding_box, previous_point, current_point, strategy);
} }
else else
{ {
// In cartesian this is expand with current point // In cartesian this is expand with current point
// in non-cartesian this is expand with a segment // in non-cartesian this is expand with a segment
box_next_in_section<typename cs_tag<point_type>::type> box_next_in_section<cs_tag_t<point_type>>
::apply(section.bounding_box, previous_point, current_point, strategy); ::apply(section.bounding_box, previous_point, current_point, strategy);
} }

View File

@ -49,10 +49,10 @@ template
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename Tag1 = typename tag<Geometry1>::type, typename Tag1 = tag_t<Geometry1>,
typename Tag2 = typename tag<Geometry2>::type, typename Tag2 = tag_t<Geometry2>,
typename CastedTag1 = typename tag_cast<Tag1, pointlike_tag, linear_tag, areal_tag>::type, typename CastedTag1 = tag_cast_t<Tag1, pointlike_tag, linear_tag, areal_tag>,
typename CastedTag2 = typename tag_cast<Tag2, pointlike_tag, linear_tag, areal_tag>::type, typename CastedTag2 = tag_cast_t<Tag2, pointlike_tag, linear_tag, areal_tag>,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
> >
struct touches struct touches

View File

@ -520,10 +520,10 @@ struct expect_output_assert
TupledOut, TupledOut,
is_tag_same_as_pred<Tag>::template pred is_tag_same_as_pred<Tag>::template pred
>::value, >::value,
typename geometry::tag_cast tag_cast_t
< <
Tag, pointlike_tag, linear_tag, areal_tag Tag, pointlike_tag, linear_tag, areal_tag
>::type >
> >
{}; {};
@ -540,29 +540,6 @@ struct expect_output
: expect_output_assert<Geometry1, Geometry2, TupledOut, Tags>... : expect_output_assert<Geometry1, Geometry2, TupledOut, Tags>...
{}; {};
template <typename CastedTag>
struct single_tag_from_base_tag;
template <>
struct single_tag_from_base_tag<pointlike_tag>
{
typedef point_tag type;
};
template <>
struct single_tag_from_base_tag<linear_tag>
{
typedef linestring_tag type;
};
template <>
struct single_tag_from_base_tag<areal_tag>
{
typedef polygon_tag type;
};
template template
< <
typename Geometry, typename Geometry,

View File

@ -30,7 +30,6 @@
#include <boost/geometry/algorithms/envelope.hpp> #include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp> #include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/box.hpp>

View File

@ -21,6 +21,8 @@
#include <boost/geometry/algorithms/detail/overlay/intersection_insert.hpp> #include <boost/geometry/algorithms/detail/overlay/intersection_insert.hpp>
#include <boost/geometry/algorithms/detail/visit.hpp> #include <boost/geometry/algorithms/detail/visit.hpp>
#include <boost/geometry/core/geometry_types.hpp> #include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/core/primary_single_tag.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility #include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp> #include <boost/geometry/strategies/detail.hpp>
@ -106,14 +108,10 @@ template
> >
struct call_intersection_insert_tupled_base struct call_intersection_insert_tupled_base
{ {
typedef typename geometry::detail::single_tag_from_base_tag using single_tag = primary_single_tag_t
< <
typename geometry::tag_cast tag_cast_t<tag_t<Geometry1>, pointlike_tag, linear_tag, areal_tag>
< >;
typename geometry::tag<Geometry1>::type,
pointlike_tag, linear_tag, areal_tag
>::type
>::type single_tag;
typedef detail::expect_output typedef detail::expect_output
< <
@ -283,11 +281,7 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1,
template template
< <
typename Geometry, typename Collection, typename Geometry, typename Collection,
typename CastedTag = typename geometry::tag_cast typename CastedTag = tag_cast_t<tag_t<Geometry>, pointlike_tag, linear_tag, areal_tag>
<
typename geometry::tag<Geometry>::type,
pointlike_tag, linear_tag, areal_tag
>::type
> >
struct multi_output_type struct multi_output_type
{ {

View File

@ -34,22 +34,22 @@ namespace dispatch
template template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename Tag1 = typename tag_cast typename Tag1 = tag_cast_t
< <
typename tag<Geometry1>::type, tag_t<Geometry1>,
segment_tag, segment_tag,
box_tag, box_tag,
linear_tag, linear_tag,
areal_tag areal_tag
>::type, >,
typename Tag2 = typename tag_cast typename Tag2 = tag_cast_t
< <
typename tag<Geometry2>::type, tag_t<Geometry2>,
segment_tag, segment_tag,
box_tag, box_tag,
linear_tag, linear_tag,
areal_tag areal_tag
>::type, >,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
> >
struct closest_points : not_implemented<Tag1, Tag2> struct closest_points : not_implemented<Tag1, Tag2>

View File

@ -45,16 +45,16 @@ template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
std::size_t DimensionCount = dimension<Geometry1>::type::value, std::size_t DimensionCount = dimension<Geometry1>::type::value,
typename Tag1 = typename tag_cast typename Tag1 = tag_cast_t
< <
typename tag<Geometry1>::type, tag_t<Geometry1>,
segment_tag, box_tag, linear_tag, areal_tag segment_tag, box_tag, linear_tag, areal_tag
>::type, >,
typename Tag2 = typename tag_cast typename Tag2 = tag_cast_t
< <
typename tag<Geometry2>::type, tag_t<Geometry2>,
segment_tag, box_tag, linear_tag, areal_tag segment_tag, box_tag, linear_tag, areal_tag
>::type, >,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
> >
struct disjoint struct disjoint

View File

@ -98,22 +98,22 @@ template
< <
Geometry1, Geometry2 Geometry1, Geometry2
>::type, >::type,
typename Tag1 = typename tag_cast typename Tag1 = tag_cast_t
< <
typename tag<Geometry1>::type, tag_t<Geometry1>,
segment_tag, segment_tag,
box_tag, box_tag,
linear_tag, linear_tag,
areal_tag areal_tag
>::type, >,
typename Tag2 = typename tag_cast typename Tag2 = tag_cast_t
< <
typename tag<Geometry2>::type, tag_t<Geometry2>,
segment_tag, segment_tag,
box_tag, box_tag,
linear_tag, linear_tag,
areal_tag areal_tag
>::type, >,
typename StrategyTag = typename distance_strategy_tag typename StrategyTag = typename distance_strategy_tag
< <
Geometry1, Geometry2, Strategy Geometry1, Geometry2, Strategy

View File

@ -369,7 +369,7 @@ namespace dispatch
template template
< <
typename Geometry, typename Geometry,
typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type typename Tag = tag_cast_t<tag_t<Geometry>, multi_tag>
> >
struct for_each_point: not_implemented<Tag> struct for_each_point: not_implemented<Tag>
{}; {};

View File

@ -51,12 +51,7 @@ namespace dispatch
template template
< <
typename Geometry, typename Geometry,
typename Tag = typename tag_cast typename Tag = tag_cast_t<tag_t<Geometry>, single_tag, multi_tag>
<
typename tag<Geometry>::type,
single_tag,
multi_tag
>::type
> >
struct num_geometries: not_implemented<Tag> struct num_geometries: not_implemented<Tag>
{}; {};

View File

@ -86,10 +86,7 @@ template
< <
typename Geometry, typename Geometry,
bool AddForOpen, bool AddForOpen,
typename Tag = typename tag_cast typename Tag = tag_cast_t<tag_t<Geometry>, multi_tag>
<
typename tag<Geometry>::type, multi_tag
>::type
> >
struct num_points: not_implemented<Tag> struct num_points: not_implemented<Tag>
{}; {};

View File

@ -310,10 +310,10 @@ inline void point_on_surface(Geometry const& geometry, Point & point,
template <typename Geometry, typename Point> template <typename Geometry, typename Point>
inline void point_on_surface(Geometry const& geometry, Point & point) inline void point_on_surface(Geometry const& geometry, Point & point)
{ {
typedef typename strategy::side::services::default_strategy using strategy_type = typename strategy::side::services::default_strategy
< <
typename cs_tag<Geometry>::type cs_tag_t<Geometry>
>::type strategy_type; >::type;
point_on_surface(geometry, point, strategy_type()); point_on_surface(geometry, point, strategy_type());
} }

View File

@ -258,10 +258,10 @@ struct remove_spikes
static void apply(Geometry& geometry, geometry::default_strategy const&) static void apply(Geometry& geometry, geometry::default_strategy const&)
{ {
typedef typename strategy::side::services::default_strategy using side_strategy = typename strategy::side::services::default_strategy
< <
typename cs_tag<Geometry>::type cs_tag_t<Geometry>
>::type side_strategy; >::type;
apply(geometry, side_strategy()); apply(geometry, side_strategy());
} }

View File

@ -18,6 +18,8 @@
#include <iterator> #include <iterator>
#include <boost/geometry/core/primary_single_tag.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/algorithms/difference.hpp> #include <boost/geometry/algorithms/difference.hpp>
#include <boost/geometry/algorithms/union.hpp> #include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> #include <boost/geometry/geometries/adapted/boost_variant.hpp>
@ -268,14 +270,14 @@ template
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename GeometryOut, typename GeometryOut,
typename TagIn1 = typename geometry::tag_cast typename TagIn1 = tag_cast_t
< <
typename tag<Geometry1>::type, pointlike_tag, linear_tag, areal_tag tag_t<Geometry1>, pointlike_tag, linear_tag, areal_tag
>::type, >,
typename TagIn2 = typename geometry::tag_cast typename TagIn2 = tag_cast_t
< <
typename tag<Geometry2>::type, pointlike_tag, linear_tag, areal_tag tag_t<Geometry2>, pointlike_tag, linear_tag, areal_tag
>::type, >,
typename TagOut = typename detail::setop_insert_output_tag<GeometryOut>::type typename TagOut = typename detail::setop_insert_output_tag<GeometryOut>::type
> >
struct sym_difference_insert struct sym_difference_insert
@ -380,15 +382,11 @@ struct sym_difference_insert
> >
: detail::expect_output : detail::expect_output
< <
Geometry1, Geometry2, GeometryOut, Geometry1, Geometry2, GeometryOut, primary_single_tag_t<TagIn1>, primary_single_tag_t<TagIn2>
typename detail::single_tag_from_base_tag<TagIn1>::type,
typename detail::single_tag_from_base_tag<TagIn2>::type
> >
, detail::sym_difference::sym_difference_different_inputs_tupled_output , detail::sym_difference::sym_difference_different_inputs_tupled_output
< <
GeometryOut, GeometryOut, primary_single_tag_t<TagIn1>, primary_single_tag_t<TagIn2>
typename detail::single_tag_from_base_tag<TagIn1>::type,
typename detail::single_tag_from_base_tag<TagIn2>::type
> >
{}; {};

View File

@ -203,8 +203,8 @@ struct select_strategy
{ {
typedef typename strategy::transform::services::default_strategy typedef typename strategy::transform::services::default_strategy
< <
typename cs_tag<Point1>::type, cs_tag_t<Point1>,
typename cs_tag<Point2>::type, cs_tag_t<Point2>,
typename coordinate_system<Point1>::type, typename coordinate_system<Point1>::type,
typename coordinate_system<Point2>::type, typename coordinate_system<Point2>::type,
dimension<Point1>::type::value, dimension<Point1>::type::value,
@ -268,8 +268,8 @@ namespace dispatch
template template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type, typename Tag1 = tag_cast_t<tag_t<Geometry1>, multi_tag>,
typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type typename Tag2 = tag_cast_t<tag_t<Geometry2>, multi_tag>
> >
struct transform {}; struct transform {};

View File

@ -24,7 +24,9 @@
#include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp> #include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp> #include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/core/point_order.hpp> #include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/primary_single_tag.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp> #include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> #include <boost/geometry/geometries/adapted/boost_variant.hpp>
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
@ -47,12 +49,12 @@ namespace dispatch
template template
< <
typename Geometry1, typename Geometry2, typename GeometryOut, typename Geometry1, typename Geometry2, typename GeometryOut,
typename TagIn1 = typename tag<Geometry1>::type, typename TagIn1 = tag_t<Geometry1>,
typename TagIn2 = typename tag<Geometry2>::type, typename TagIn2 = tag_t<Geometry2>,
typename TagOut = typename detail::setop_insert_output_tag<GeometryOut>::type, typename TagOut = typename detail::setop_insert_output_tag<GeometryOut>::type,
typename CastedTagIn1 = typename geometry::tag_cast<TagIn1, areal_tag, linear_tag, pointlike_tag>::type, typename CastedTagIn1 = tag_cast_t<TagIn1, areal_tag, linear_tag, pointlike_tag>,
typename CastedTagIn2 = typename geometry::tag_cast<TagIn2, areal_tag, linear_tag, pointlike_tag>::type, typename CastedTagIn2 = tag_cast_t<TagIn2, areal_tag, linear_tag, pointlike_tag>,
typename CastedTagOut = typename geometry::tag_cast<TagOut, areal_tag, linear_tag, pointlike_tag>::type, typename CastedTagOut = tag_cast_t<TagOut, areal_tag, linear_tag, pointlike_tag>,
bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
> >
struct union_insert: not_implemented<TagIn1, TagIn2, TagOut> struct union_insert: not_implemented<TagIn1, TagIn2, TagOut>
@ -164,10 +166,7 @@ struct union_insert
false false
> >
{ {
using single_tag = typename geometry::detail::single_tag_from_base_tag using single_tag = primary_single_tag_t<CastedTagIn>;
<
CastedTagIn
>::type;
using expect_check = detail::expect_output using expect_check = detail::expect_output
< <
@ -278,20 +277,14 @@ struct union_insert
false false
> >
{ {
using single_tag1 = typename geometry::detail::single_tag_from_base_tag using single_tag1 = primary_single_tag_t<CastedTagIn1>;
<
CastedTagIn1
>::type;
using expect_check1 = detail::expect_output using expect_check1 = detail::expect_output
< <
Geometry1, Geometry2, SingleTupledOut, single_tag1 Geometry1, Geometry2, SingleTupledOut, single_tag1
>; >;
using single_tag2 = typename geometry::detail::single_tag_from_base_tag using single_tag2 = primary_single_tag_t<CastedTagIn2>;
<
CastedTagIn2
>::type;
using expect_check2 = detail::expect_output using expect_check2 = detail::expect_output
< <

View File

@ -0,0 +1,55 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP
#define BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry
{
/*!
\brief Metafunction defining a type being the primary tag
(point, linestring, polygon) of the tag related to its topological dimension.
\details pointlike_tag will be casted to point_tag, linear_tag to linestring_tag,
areal_tag to polygon_tag.
\ingroup core
\tparam Tag The tag to get the canonical tag from
*/
template <typename Tag>
struct primary_single_tag
{
};
template <>
struct primary_single_tag<pointlike_tag>
{
using type = point_tag;
};
template <>
struct primary_single_tag<linear_tag>
{
using type = linestring_tag;
};
template <>
struct primary_single_tag<areal_tag>
{
using type = polygon_tag;
};
template <typename Tag>
using primary_single_tag_t = typename primary_single_tag<Tag>::type;
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP

View File

@ -66,7 +66,6 @@ struct tag_cast<Tag, BaseTag, BaseTags...>
template <typename Tag, typename ...BaseTags> template <typename Tag, typename ...BaseTags>
using tag_cast_t = typename tag_cast<Tag, BaseTags...>::type; using tag_cast_t = typename tag_cast<Tag, BaseTags...>::type;
}} // namespace boost::geometry }} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP #endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP

View File

@ -40,7 +40,7 @@ template
typename Point, typename Point,
typename NewCoordinateType, typename NewCoordinateType,
typename NewUnits, typename NewUnits,
typename CS_Tag = typename cs_tag<Point>::type typename CS_Tag = cs_tag_t<Point>
> >
struct helper_point struct helper_point
{ {

View File

@ -326,11 +326,11 @@ public:
{ {
dispatch::dsv dispatch::dsv
< <
typename tag_cast tag_cast_t
< <
typename tag<Geometry>::type, tag_t<Geometry>,
multi_tag multi_tag
>::type, >,
Geometry Geometry
>::apply(os, m.m_geometry, m.m_settings); >::apply(os, m.m_geometry, m.m_settings);
os.flush(); os.flush();

View File

@ -186,11 +186,7 @@ struct devarianted_svg_map
{ {
svg_map svg_map
< <
typename tag_cast tag_cast_t<tag_t<Geometry>, multi_tag>,
<
typename tag<Geometry>::type,
multi_tag
>::type,
typename std::remove_const<Geometry>::type, typename std::remove_const<Geometry>::type,
SvgPoint SvgPoint
>::apply(stream, style, size, geometry, strategy); >::apply(stream, style, size, geometry, strategy);

View File

@ -29,7 +29,7 @@ namespace strategy { namespace within
template template
< <
typename Point1, typename Point2, typename Point1, typename Point2,
typename CSTag = typename cs_tag<Point1>::type typename CSTag = cs_tag_t<Point1>
> >
struct point_in_point struct point_in_point
: strategy::within::cartesian_point_point : strategy::within::cartesian_point_point

View File

@ -65,10 +65,10 @@ class oriented_winding
>::type calculation_type; >::type calculation_type;
typedef typename strategy::side::services::default_strategy using strategy_side_type = typename strategy::side::services::default_strategy
< <
typename cs_tag<Point>::type cs_tag_t<Point>
>::type strategy_side_type; >::type;
/*! subclass to keep state */ /*! subclass to keep state */

View File

@ -45,11 +45,7 @@ template
typename Point, typename Point,
typename PointOfSegment, typename PointOfSegment,
typename CalculationType, typename CalculationType,
typename CSTag = typename tag_cast typename CSTag = tag_cast_t<cs_tag_t<Point>, spherical_tag>
<
typename cs_tag<Point>::type,
spherical_tag
>::type
> >
struct winding_base_type struct winding_base_type
{ {
@ -65,7 +61,7 @@ struct winding_base_type<Point, PointOfSegment, CalculationType, cartesian_tag>
< <
typename strategy::side::services::default_strategy typename strategy::side::services::default_strategy
< <
typename cs_tag<Point>::type cs_tag_t<Point>
>::type, >::type,
CalculationType CalculationType
>; >;
@ -76,10 +72,7 @@ struct winding_base_type<Point, PointOfSegment, CalculationType, spherical_tag>
{ {
using type = within::detail::spherical_winding_base using type = within::detail::spherical_winding_base
< <
typename strategy::side::services::default_strategy typename strategy::side::services::default_strategy<cs_tag_t<Point>>::type,
<
typename cs_tag<Point>::type
>::type,
CalculationType CalculationType
>; >;
}; };

View File

@ -216,8 +216,8 @@ template
typename Point1, typename Point1,
typename Point2 = Point1, typename Point2 = Point1,
int Dimension = -1, int Dimension = -1,
typename CSTag1 = typename cs_tag<Point1>::type, typename CSTag1 = cs_tag_t<Point1>,
typename CSTag2 = typename cs_tag<Point2>::type typename CSTag2 = cs_tag_t<Point2>
> >
struct default_strategy struct default_strategy
{ {

View File

@ -369,9 +369,9 @@ inline void check()
< <
Geometry1, Geometry1,
Geometry2, Geometry2,
typename tag<Geometry1>::type, tag_t<Geometry1>,
typename tag<Geometry2>::type, tag_t<Geometry2>,
typename tag_cast<typename tag<Geometry2>::type, areal_tag>::type, tag_cast_t<tag_t<Geometry2>, areal_tag>,
Strategy Strategy
> c; > c;
boost::ignore_unused(c); boost::ignore_unused(c);

View File

@ -40,7 +40,7 @@ template
< <
typename Geometry1, typename Geometry1,
typename Point, typename Point,
typename CsTag = typename cs_tag<Point>::type typename CsTag = cs_tag_t<Point>
> >
struct strategy_convex_hull struct strategy_convex_hull
{ {

View File

@ -54,26 +54,26 @@ template
typename GeometryContaining, typename GeometryContaining,
typename TagContained = typename tag<GeometryContained>::type, typename TagContained = typename tag<GeometryContained>::type,
typename TagContaining = typename tag<GeometryContaining>::type, typename TagContaining = typename tag<GeometryContaining>::type,
typename CastedTagContained = typename tag_cast typename CastedTagContained = tag_cast_t
< <
typename tag<GeometryContained>::type, tag_t<GeometryContained>,
pointlike_tag, linear_tag, polygonal_tag, areal_tag pointlike_tag, linear_tag, polygonal_tag, areal_tag
>::type, >,
typename CastedTagContaining = typename tag_cast typename CastedTagContaining = tag_cast_t
< <
typename tag<GeometryContaining>::type, tag_t<GeometryContaining>,
pointlike_tag, linear_tag, polygonal_tag, areal_tag pointlike_tag, linear_tag, polygonal_tag, areal_tag
>::type, >,
typename CsTagContained = typename tag_cast typename CsTagContained = tag_cast_t
< <
typename cs_tag<typename point_type<GeometryContained>::type>::type, cs_tag_t<point_type_t<GeometryContained>>,
spherical_tag spherical_tag
>::type, >,
typename CsTagContaining = typename tag_cast typename CsTagContaining = tag_cast_t
< <
typename cs_tag<typename point_type<GeometryContaining>::type>::type, cs_tag_t<point_type_t<GeometryContaining>>,
spherical_tag spherical_tag
>::type >
> >
struct default_strategy struct default_strategy
{ {

View File

@ -33,12 +33,12 @@ template
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename Tag1 = typename geometry::tag<Geometry1>::type, typename Tag1 = tag_t<Geometry1>,
typename Tag2 = typename geometry::tag<Geometry2>::type, typename Tag2 = tag_t<Geometry2>,
int TopDim1 = geometry::topological_dimension<Geometry1>::value, int TopDim1 = geometry::topological_dimension<Geometry1>::value,
int TopDim2 = geometry::topological_dimension<Geometry2>::value, int TopDim2 = geometry::topological_dimension<Geometry2>::value,
typename CsTag1 = typename cs_tag<Geometry1>::type, typename CsTag1 = cs_tag_t<Geometry1>,
typename CsTag2 = typename cs_tag<Geometry2>::type typename CsTag2 = cs_tag_t<Geometry2>
> >
struct default_strategy struct default_strategy
: relate::services::default_strategy : relate::services::default_strategy

View File

@ -94,8 +94,8 @@ template
typename GeometryTag2, typename GeometryTag2,
typename Point1, typename Point1,
typename Point2 = Point1, typename Point2 = Point1,
typename CsTag1 = typename cs_tag<Point1>::type, typename CsTag1 = cs_tag_t<Point1>,
typename CsTag2 = typename cs_tag<Point2>::type, typename CsTag2 = cs_tag_t<Point2>,
typename UnderlyingStrategy = void typename UnderlyingStrategy = void
> >
struct default_strategy struct default_strategy

View File

@ -229,11 +229,7 @@ struct spherical_point
detail::normalize_point detail::normalize_point
< <
PointIn, PointOut, PointIn, PointOut,
(! std::is_same (! std::is_same<cs_tag_t<PointIn>, spherical_polar_tag>::value)
<
typename cs_tag<PointIn>::type,
spherical_polar_tag
>::value)
>::apply(point_in, point_out); >::apply(point_in, point_out);
} }
}; };
@ -246,11 +242,7 @@ struct spherical_box
detail::normalize_box detail::normalize_box
< <
BoxIn, BoxOut, BoxIn, BoxOut,
(! std::is_same (! std::is_same<cs_tag_t<BoxIn>, spherical_polar_tag>::value)
<
typename cs_tag<BoxIn>::type,
spherical_polar_tag
>::value)
>::apply(box_in, box_out); >::apply(box_in, box_out);
} }
}; };

View File

@ -52,28 +52,28 @@ template
< <
typename GeometryContained, typename GeometryContained,
typename GeometryContaining, typename GeometryContaining,
typename TagContained = typename tag<GeometryContained>::type, typename TagContained = tag_t<GeometryContained>,
typename TagContaining = typename tag<GeometryContaining>::type, typename TagContaining = tag_t<GeometryContaining>,
typename CastedTagContained = typename tag_cast typename CastedTagContained = tag_cast_t
< <
typename tag<GeometryContained>::type, tag_t<GeometryContained>,
pointlike_tag, linear_tag, polygonal_tag, areal_tag pointlike_tag, linear_tag, polygonal_tag, areal_tag
>::type, >,
typename CastedTagContaining = typename tag_cast typename CastedTagContaining = tag_cast_t
< <
typename tag<GeometryContaining>::type, tag_t<GeometryContaining>,
pointlike_tag, linear_tag, polygonal_tag, areal_tag pointlike_tag, linear_tag, polygonal_tag, areal_tag
>::type, >,
typename CsTagContained = typename tag_cast typename CsTagContained = tag_cast_t
< <
typename cs_tag<typename point_type<GeometryContained>::type>::type, cs_tag_t<point_type_t<GeometryContained>>,
spherical_tag spherical_tag
>::type, >,
typename CsTagContaining = typename tag_cast typename CsTagContaining = tag_cast_t
< <
typename cs_tag<typename point_type<GeometryContaining>::type>::type, cs_tag_t<point_type_t<GeometryContaining>>,
spherical_tag spherical_tag
>::type >
> >
struct default_strategy struct default_strategy
{ {

View File

@ -90,10 +90,7 @@ namespace detail
template <typename Geometry> template <typename Geometry>
struct default_intersection_strategy struct default_intersection_strategy
: strategy::intersection::services::default_strategy : strategy::intersection::services::default_strategy<cs_tag_t<Geometry>>
<
typename cs_tag<Geometry>::type
>
{}; {};
template <typename PointLike, typename Geometry> template <typename PointLike, typename Geometry>

View File

@ -343,7 +343,7 @@ public:
Box& mbr, Box& mbr,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef envelope_segment_convert_polar<Units, typename cs_tag<Box>::type> convert_polar; typedef envelope_segment_convert_polar<Units, cs_tag_t<Box>> convert_polar;
convert_polar::pre(lat1, lat2); convert_polar::pre(lat1, lat2);

View File

@ -189,7 +189,7 @@ struct spherical_point
expand::detail::point_loop_on_spheroid expand::detail::point_loop_on_spheroid
< <
dimension<Point>::value, dimension<Point>::value,
! std::is_same<typename cs_tag<Point>::type, spherical_polar_tag>::value ! std::is_same<cs_tag_t<Point>, spherical_polar_tag>::value
>::apply(box, point); >::apply(box, point);
} }
}; };

View File

@ -129,18 +129,8 @@ template
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename Strategy, typename Strategy,
typename Tag1 = typename tag_cast typename Tag1 = tag_cast_t<tag_t<Geometry1>, segment_tag, linear_tag>,
< typename Tag2 = tag_cast_t<tag_t<Geometry2>, segment_tag, linear_tag>,
typename tag<Geometry1>::type,
segment_tag,
linear_tag
>::type,
typename Tag2 = typename tag_cast
<
typename tag<Geometry2>::type,
segment_tag,
linear_tag
>::type,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
> >
struct distance_brute_force struct distance_brute_force

View File

@ -49,8 +49,8 @@ template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename Strategy, typename Strategy,
typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type, typename Tag1 = tag_cast_t<tag_t<Geometry1>, multi_tag>,
typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type, typename Tag2 = tag_cast_t<tag_t<Geometry2>, multi_tag>,
typename StrategyTag = typename strategy::services::tag<Strategy>::type, typename StrategyTag = typename strategy::services::tag<Strategy>::type,
bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
> >