Boost logo

Geometry :

Subject: Re: [geometry] Area strategies interface change proposal
From: Vissarion Fisikopoulos (fisikop_at_[hidden])
Date: 2017-12-11 13:12:39


On 7 December 2017 at 02:12, Adam Wulkiewicz via Geometry
<geometry_at_[hidden]> wrote:
> Hi,
>
> I propose to change the interface of area strategies to make them easier to
> use, make template parameters independent of PointOfSegment and make them
> consistent with other strategies in the following way:
> - remove PointOfSegment template parameter
> - replace return_type typedef with member class template, and then in
> algorithm replace:
> typename Strategy::return_type
> with
> typename Strategy::template result_type<Geometry>::type
> - replace state_type typedef with member class template, and then in
> algorithm replace:
> typename Strategy::state_type state;
> with
> typename Strategy::template state<Geometry> state;
> - add bg::area_result<Geometry, Strategy> metafunction simplifying the
> definition of area's result-type, so similar to already existing
> bg::default_area_result<Geometry>, then this:
> typename Strategy::template result_type<Geometry>::type
> is simplified to:
> typename area_result<Geometry, Strategy>::type
> - in spherical area strategy add either of these template parameters:
> - RadiusType like in haversine distance strategy (defaulting to double)
> - Sphere like in geographic strategies taking Spheroid (defaulting to
> bg::srs::sphere<double>)
> - rename bg::strategy::area::surveyor to bg::strategy::area::cartesian
>
> After these changes the user would be able to write:
>
> auto a = bg::area(g1, bg::strategy::area::cartesian<>());
> auto b = bg::area(g2, bg::strategy::area::spherical<>()); // probably unit
> sphere to be backward compatible with default-constructed spherical strategy
> auto c = bg::area(g3, bg::strategy::area::geographic<>()); // WGS84, default
> srs::spheroid
>
> auto d = bg::area(g1, bg::strategy::area::cartesian<>());
> auto e = bg::area(g2, bg::strategy::area::spherical<>(6370997.0)); //
> Earth's mean radius, or instead of Radius take Sphere
> auto f = bg::area(g3,
> bg::strategy::area::geographic<>(bg::srs::spheroid<double>(6378206.4,
> 6356583.8))); // Clarke 1866
>
> What do you think?

Sounds great to me. Thanks.

--Vissarion.

> Adam
>
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/geometry
>


Geometry list run by mateusz at loskot.net