Re: Delaunay and Java3D

Hi, 
sure I can Display the results with VisAD, but unfortunately that is not
what I want, because I want to use my own "Display"-classes.
I need to put the 3D-object-content in my class "Layer3D.java" which is
waiting for a Shape3D or a BranchGroup or a TransformGroup from Java3D.
Due to your previous mail I got the idea, maybe I could use the
Java3D-scenegraph produced from VisAD.
So i tried to track down the VisAD-BranchGroup the following way:

  DisplayImplJ3D visad;
            visad = test.getVisADDisplay();
            visad.getDefaultDisplayRenderer();
            DisplayRenderer visadrend = visad.getDefaultDisplayRenderer();
            if (visadrend instanceof DefaultDisplayRendererJ3D) {
                DefaultDisplayRendererJ3D visaddd
(DefaultDisplayRendererJ3D) visadrend;
                TransformGroup visadtrans = visaddd.getTrans();

                // GIS3DView machen und fuellen
                GIS3DView gis3dView = new GIS3DView(true);
                Layer3D layer3d = new Layer3D();
                layer3d.addTransformGroup(visadtrans);
                gis3dView.addLayer(layer3d);

                GisTermService s = GisTerm.lookupService("GisTerm");
                JTabbedPane p = gisTerm.getTabbedPane();
                //p.add("VisAD",visad.getComponent());
                p.add("VisAD",gis3dView);
                p.setSelectedComponent(gis3dView);
            }

Then I get the following Compiler error:

javac -g  GroundWaterApp.java
GroundWaterApp.java:157: No method matching
getDefaultDisplayRenderer() found in class visad.java3d.DisplayImplJ3D.
            DisplayRenderer visadrend = visad.getDefaultDisplayRenderer();
                                                                       ^
1 error

My Visad API says the method is protected.
Can I change the source code to get the DisplayRenderer ?
And which of the methods in DisplayRendererJ3D (which are all not
commented) would be the right one to get the 3D-content of the Java3D
scenegraph and not the content of the ViewBranchGraph.

Ok , I know that is probably not for what VisAD was developed:
"VisAD shields applications developers from details of graphics APIs. Thus
for most applications, the only
difference between Java3D and Java2D displays is whether they are
constructed with DisplayImplJ3D or
DisplayImplJ2D, and the constraint that Java2D displays cannot involve
ScalarMaps to ZAxis, Latitude or Alpha."

But is it possible or are there any alternatives?

Thanks for any help 

Desiree


o------------------------------------------------------------------------o
| Desiree Hilbring      Institut fuer Photogrammetrie und Fernerkundung  | 
|                       Universitaet Karlsruhe, Germany                  |
|                                                                        |
|                       email: hilbring@xxxxxxxxxxxxxxxxxxxx             |
|                       # 0721 6083676                                   |
o------------------------------------------------------------------------o

On Wed, 23 Aug 2000, Bill Hibbard wrote:

> Hi Desiree,
> 
> > Hi thanks for your help, VisAd is working now, and I tried to implement
> > your hints.
> > So after the Triangulation I get an object terrain (class FlatField), how
> > does the geometry of this object looks like?
> > For implementing some Java3D-Objects for my application, I guess I need
> > some information about triangles, so that I know these coordinates go
> > together to build a triangle for building a 3D-object.
> > Sorry I am not experienced with Triangulations, am I wrong?
> > How would I got to build my 3D-obejcts?
> > . . .
> > > Assume that the locations of your points are defined in two
> > > arrays:
> > >
> > >   float[] x_locations, y_locations;
> > >
> > > and the terrain heights at these points are defined in the
> > > array:
> > >
> > >   float[] heights;
> > >
> > > Then you can create a terrain as a FlatField like this:
> > >
> > >   RealType x = RealType.getRealType("x");
> > >   RealType y = RealType.getRealType("y");
> > >   RealType height = RealType.getRealType("height");
> > >   RealTupleType xy = new RealTupleType(x, y);
> > >   FunctionType terrain_type = new FunctionType(xy, height);
> > >
> > >   Irregular2DSet set
> > >     new Irregular2DSet(xy, new float[][] {x_locations, y_locations});
> > >   FlatField terrain = new FlatField(terrain_type, set);
> > >   terrain.setSamples(new float[][] {heights});
> 
> To display your terrain, you construct a display, add some
> ScalarMaps, add the terrain, and add your display to a GUI:
> 
>   DisplayImplJ3D display = new DisplayImplJ3D("name");
>   display.addMap(new ScalarMap(x, Display.XAxis));
>   display.addMap(new ScalarMap(y, Display.YAxis));
>   display.addMap(new ScalarMap(height, Display.ZAxis));
>   DataReferenceImpl terrain_ref = new DataReferenceImpl("terrain");
>   terrain_ref.setData(terrain);
>   display.addReference(terrain_ref);
>   JFrame frame = ...
>   . . .
>   frame.getContentPane().add(display.getComponent());
>   . . .
> 
> You don't need to worry about constructing a 3-D object.
> That is a service provided by VisAD.
> 
> Please study the tutorials and examples.
> 
> Cheers,
> 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
> 


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