Re: Add TransformGroup to VisAD

You'll probably need to construct your TransformGroup and
a BranchGroup, add your TransformGroup as a child of your
BranchGroup, then add your BranchGroup to the tg you get
from VisAD.

It shouldn't be too difficult to figure this sort of thing
out from the error message, so please experiment a bit
before asking.

Good luck,
Bill

gaoming fu wrote:
> 
> Hi, Bill:
> 
> Thank you very much for your help.
> 
> I tried the following in my class:
> 
> DisplayRendererJ3D dr = (DisplayRendererJ3D)display.getDisplayRenderer();
> TransformGroup tg = dr.getTrans();
> tg.addChild(myTransformGroup);
> 
> Because display.getDisplayRenderer() will only return DisplayRenderer, so I 
> casted it to
> 
> DisplayRendererJ3D. The class compiled well, but I got a runtime error: 
> javax.media.j3d.RestrictedAccessException: Group: only a BranchGroup
> node may be added.
> 
> I also tried the following:
> 
>  DisplayRendererJ3D dr = (DisplayRendererJ3D)display.getDisplayRenderer();
>    BranchGroup bg = dr.getRoot();
>   bg.addChild(myTransformGroup);
> 
> I got the same runtime error.
> 
> Please advise. Thanks a lot.
> 
> Gaoming
> 
> 
> 
> >From: Bill Hibbard
> >To: gaoming fu
> >CC: visad-list@xxxxxxxxxxxxx
> >Subject: Re: Irregular2DSet and contour lines
> >Date: Thu, 29 Nov 2001 06:15:02 -0600
> >
> >Hi Gaoming,
> >
> > > 1. I used Irregular2DSet to draw the following data.
> > >
> > > 4.0f 3.2f 9.0f
> > > 5.4f 4.0f 9.0f
> > > 4.0f 5.3f 9.0f
> > > 3.2f 4.0f 9.0f
> > > 4.0f 2.0f 8.0f
> > > 6.0f 3.0f 8.0f
> > > 6.0f 4.0f 8.0f
> > > 5.0f 5.0f 8.0f
> > > 4.0f 6.0f 8.0f
> > > 3.0f 6.0f 8.0f
> > > 2.0f 5.0f 8.0f
> > > 2.0f 4.0f 8.0f
> > > 2.0f 4.0f 4.0f
> > > 4.0f 2.0f 4.0f
> > > 6.0f 3.0f 4.0f
> > > 6.0f 4.0f 4.0f
> > > 5.0f 5.0f 4.0f
> > > 4.0f 6.0f 4.0f
> > > 3.0f 6.0f 4.0f
> > > 2.0f 5.0f 4.0f
> > >
> > > I can not see any points with z values of 4.0, i.e., there is no surface 
> > > drawn between
> > > points with z value of 4.0 and points with z values of 8.0 and 9.0. But 
> > > all the points can
> > > be seen in the point mode. Please note that points with z values of 4.0 
> > > have the same
> > > x and y values as points with z values of 8.0.
> >
> >If you are constructing an Irregular2DSet, then you must be
> >representing your data as a FlatField with a 2-D domain and
> >MathType ((x, y) -> z). But if you have different z values
> >(4.0 and 8.0) at the same (x, y) locations, then z is not a
> >function of (x, y). If you are passing all your (x, y) locations
> >to the Irregular2DSet constructor, some of them will be
> >identical, which will cause trouble in the implicit call to
> >the Delaunay constructor.
> >
> >Because z is not a function of (x, y) you probably shouldn't
> >try to depict your data as a functional surface. You might
> >partition your data, so that the points in each partition
> >do define a function relation ((x, y) -> z), then depict
> >your data as multiple surfaces, one for each partition.
> >
> > > 2. I want to draw 3D surface together with contour lines and the contour 
> > > line should be
> > > labeled with elevation.
> >
> >You can construct ScalarMaps of z to ZAxis and to IsoContour.
> >However, 2-D contour labeling currently only works for
> >GriddedSets, so you will need to resample to a grid to get
> >labels. A high resolution grid will be the most faithful
> >to your original data.
> >
> > > 3. Can I add my own TransformGroup (i.e., built from java3d,without
> > > using any VisAD) to DisplayImplJ3D in a class built using VisAD, and then 
> > > draw it together with any other data processed using VisAD, in
> the
> > > same Coordinate system?
> >
> >Yes. Try:
> >
> > DisplayRendererJ3D dr = display.getDisplayRenderer();
> > TransformGroup tg = dr.getTrans();
> >
> >Now you can add your own TransformGroup under tg. Note
> >that the Transform3D in tg is controlled by the VisAD
> >ProjectionControl and mouse rotate, translate and zoom.
> >If you want to add your TransformGroup above this, then
> >add them to the BranchGroup:
> >
> > BranchGroup bg = dr.getRoot();
> >
> >Good luck,
> >Bill
> >----------------------------------------------------------
> >Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
> >hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738
> >http://www.ssec.wisc.edu/~billh/vis.html
> 
> ----------------------------------------------------------------------------------------------------------------------------------------------
> Get your FREE download of MSN Explorer at http://explorer.msn.com

-- 
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: