[GRASS5] Fw: d.area progress report...

Michel Wurtz mw at teledetection.fr
Tue Jan 22 06:37:35 EST 2002


"Eric G. Miller" wrote:

> Basically, I'm trying to implement an addition to the display
> library which consists of the following three functions:
> 
>   D_area_begin()   -- Set up for a new area
>   D_area_add_ring (struct line_pnts *) -- Add one or more boundaries.
>   D_area_finish()  -- Process the rings and draw the result to the
>                       display.
> 
> I'm not sure how to handle the colinear segments problem.  I'm
> thinking it might be better to have an interface level where the
> user passes a Map_info struct, and the id for the area to draw.
> I could then weed out the colinear segments by not adding any
> edge that didn't have the target area on one of it's sides.
> Then the interface would reduce to:
> 
>   D_area_plot (struct Map_info *, int);
> 
> Later on, I hope to implement a more generic (but more expensive)
> variant to handle essentially random polys that may intersect.
> I think such a routine won't be linked to the display environment,
> but more of an on the fly polygon intersector.
> 
> Taking comments... ?

Eric,
I developped some 20 years ago (before X11) a set of functions for
a graphic card in order to create a graphical GUI similar to the
Suntools one.
Searching in my archives (Yes, I keeped the C code), I found some
functions very useable for d.area : the first adds one boundary,
the second finish the process.  the filling routine is passed as
a parameter : my implementation had the possibility to fill with
plain color or with a pattern.
The algorithm is just based on the traversal of elementary segments,
so holes and twisted polygons are managed.
We should adapt the code for d.area (but the commentaries are all in
french ;-)
I have not keeped the code for filling, but It was very hardware
dependant, and I could easely rewrote it. BTW, I think it may be
done in the monitor driver (the drawing function's parameters are
the row number, the start and end column in monitor coordinates).

regards,
--
Michel WURTZ - DIG - Maison de la télédétection
               500, rue J.F. Breton
               34093 MONTPELLIER Cedex 5



More information about the grass-dev mailing list