Re: Rivers

John,
 
Two excellent questions.
 
> 1) If I want, say, the confluence of the south flowing river and the
> east feeder river to be represented by a node, ie a very small circle,
> how do I render this circle? Given your example, I can devise a set of
> node coordinates and radii. What eludes me is how to access the
> API-specific method for drawing these circles (if that's how you'ld
> approach this; typically graphic api's offer ellipses and other shapes).
> I could also use rectangles, but could create these with line segments.
> Anyway, that's the idea.
 
VisAD is designed to shield applications from the details of
graphics API's.  Once you've got your data in VisAD data objects,
you only need a couple methods of DisplayImpl and ScalarMap in
order to display your data.
 
Of course, as your questions illustrate, sometimes applications
need access to graphics APIs in order to customize depictions of
data.
 
In your case, your river 'Sets' are transformed into graphics
geometry by the make1DGeometry method of Gridded2DSet and
UnionSet.  One approach would be to extend Gridded2DSet and
UnionSet, and override the implementation of the make1DGeometry
method in your extension classes, to make the sort of graphics
geometry you want.  Then construct your river systems using
your extensions to Gridded2DSet and UnionSet.  Of course, doing
this will take you into the world of computational geometry,
which can be a pain.
 
A simpler apporach might be to reprent your river systems using
a Tuple consisting of two Sets: the first your current UnionSet
of Gridded2DSets each with manifold dimension = 1, the second a
UnionSet of SingletonSets (which have manifold dimension = 0)
giving the locations of river confluences.  Sets with manifold
dimension = 0 are depicted as squares (size determined by a
ConstantMap to Display.PointSize) rather than circles.  You
could change this depiction by extending SingletonSet to
override the implementation of the makePointGeometry method to
draw circles rather than squares.
 
Right now, SingletonSet is the only Set class with manifold
dimension = 0, and your question makes me think that there should
be constructors for Gridded1DSet, Gridded2DSet and Gridded3DSet
with manifold dimension = 0.  One of these days.
 
> 2) How do I render lables? For example, I would want to label a feeder
> river as "Calsag Inflow" and a node as "Calsag Confluence", and so
> forth.
 
Right now, you'd need to extend DataRenderer, DisplayRenderer
and one or more of the ShadowType classes, plus define a new
instance of DisplayRealType for text display.  The idea is that
you could have a FunctionType like:
 
  (list_index -> (..., x, y, text, ...))
 
where list_index, x and y are RealTypes and text is a TextType.
Then you'd construct ScalarMaps x -> Display.XAxis,
y -> Display.YAxis and text -> Display.Text and the DataRenderer
would render the text values at the associated x and y locations.
Your DisplayRenderer extension would need to override the
legalDisplayScalar method to allow Display.Text, and your
DataRenderer extension would need to override the appropriate
makeShadow*Type method to return your extension of some
Shadow*TypeJ*D class.  If you wanted it to work with both
Java3D and Java2D, you'd need to extend both sets of classes.
 
However, this all sounds like such a good idea (text rendering)
that we will add it to the existing DefaultRendererJ3D and
DefaultRendererJ2D classes, and define Display.Text as a system
intrinsic.  The big question is whether I can squeeze it in
before my absence during October and November (working at ECMWF).
I cannot promise when we will do it, but we will do it.
 
Cheers,
Bill
 
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html
 
"kill cross-platform Java by growing the polluted Java market"
   - from an internal Microsoft planning document