Re: Custom data renderer / shadowtype

  • To: Tennessee James Leeuwenburg <tjl@xxxxxxxxxx>
  • Subject: Re: Custom data renderer / shadowtype
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Mon, 5 Apr 2004 13:55:30 -0500 (CDT)
Hi Tennessee,

The VisAD list never fails to heat up immediately when I leave
on a long travel. I will be away from my office until 3 May,
but will try to give you a sort of answer. You'll have to do a
lot by experimentation. Tom Rink can probably also help, since
he has made a lot of improvements in contouring.

> Looking around, it seemed like if I wanted to do my own contouring, the
> steps I would need to follow are :
>
> 1.) Create a custom DataRenderer, whose basic job is to return custom
> ShadowTypes when they are asked for.
>
> 2.) Extend ShadowType and override the methods that I care about

Yes, your DataRenderer extension would override makeShadowFunctionType()
to construct and return your extension of ShadowFunctionTypeJ3D. It
would override the makeContour() method. I think you could start with
a cut and paste of the implementation in visad.ShadowType (you might
want to test with that literal cut and paste to see if that has any
problems). Then figure out what contour cases (e.g. 2-D or 3-D) you want
to change, look for the appropriate code section in makeContour(), and
modify. It calls methods of Set classes like makeIsoSurface() and
makeIsoLines() to actually compute the geometries (line and triangles),
and then add them to the scene graph ('Object group') via calls to
addToGroup().

Tom Rink's improvements for iso-lines have made them much more
complex, in terms of label placement and label size which are
dynamic as the user zooms. There are also calls to adjustSeam()
and adjustLongitude() to manage cases where contours cross map
discontinuities. Your best bet is to study the code, get what
you can out of the tutorial, experiment, and send specific
questions to this list.

> However, I'm not sure how the innards of the ShadowType class really
> hang together. What I want to do is (I think) change the MakeContour
> method in order to change the way contouring works. (Just for argument's
> sake, let's pretend I can do that).
>
> But I don't know who calls this method or why.

When the calling code has determined that contours are requested
(by relevant ScalarMaps to IsoContour), it calls makeContour()
to compute geometries and add them to the scene graph.

> I'd really like to understand the execution flow.

There is some of this in sections 1.6 and 1.7 of the tutorial,
otherwise use grep and follow the code.

> Also, I don't know to what extent the ShadowType classes are part of an
> interface - i.e. what methods are relied upon by other VisAD classes,
> which ones are part of the ShadowType structure, which ones are just
> internal etc.

See section 1.4 of the tutorial for the general structure of
ShadowTypes. They are classes designed to be extended, not
interfaces. The best guide to the methods is sections 1.6
and 1.7 of the tutorial.

If you tell us what changes you have in mind, we can advise you
about the most important section of the tutorial, '1.2 How to
Avoid Writing Non-Default DataRenderers'. There may be a way to
do what you want with a CellImpl and a DisplayImpl, rather than
a custom DataRenderer.

Cheers,
Bill