[postgis-devel] Location Of LWAlgorithms

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Dec 24 06:13:24 PST 2008


Paul Ramsey wrote:

> I've started an lwalgorithm.c file. However, I see some functions are
> living with the types they work against. ptarray_substring, for
> example. By a similar token, area should move to lwpoly and lwmpoly
> implementations for area. Anyone have a problem with a general rule of
> locating methods with their objects, or should we keep the object
> files restricted to constructors/accessors and put all the
> calculations elsewhere?
> 
> P.

For me, the common sense approach would be to think with an 
object-oriented brain. So I would argue that direct properties of items, 
e.g. length of linestrings, areas of polygons etc. should live in the 
individual lwline.c/lwpoly.c files. For higher level algorithms, e.g. 
calculating clipping/intersection points, the code should live in your 
separate lwalgorithm.c file. Does that help at all?


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list