|
Geometry : |
Subject: [ggl] distance and reversible
From: Barend Gehrels (barend)
Date: 2009-05-03 13:10:00
Hi,
By the refactoring of distance/multi a small problem became clear. Not in
the reversible itself, but in the selected strategy, in special cases.
Reversible: this implements that point/linestring is handled by the same
dispatch as linestring/point.
However, if there are two different point types, a strategy is chosen.
E.g. pythagoras<a,b>. If the geometries are reversed, the strategy should
also be reversed.
That is done, but not yet for user-specified strategies. During the
fix-in-progress I changed the reverse implementation. I added a
"reverse_dispatch" metafunction returning true if it is to be reversed.
For this I added a "geometry_id" metafunction giving an ID to a geometry
type.
Implementation will be that each strategy should have a copy constructor,
copying from the reversed version (?). I think it should be like that
because the library not only takes a default strategy (that one is solved
now) but also allows users to select their own strateg. E.g.
double d = ggl::distance(my_line_in_degrees, my_point_in_radians,
vincenty<point_in_deg, point_in_rad>);
The library is reversing line/point so should reverse vincenty to
vincenty<...rad, deg>
An other advantage of all this is that the distance dispatch itself does
not need to be aware of reversals. So we will profit from this for
union/intersection/all functions able to handle two geometry types.
Regards, Barend
Geometry list run by mateusz at loskot.net