Boost logo

Geometry :

Subject: [geometry] Area strategies interface change proposal
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2017-12-07 00:12:18


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?

Adam



Geometry list run by mateusz at loskot.net