Re: How to draw interactive contours

Hi Renaud,

> my purpose is to plot some set of points on a 3D display, and once the scene 
> is rendered, to interactively draw some contours around some
> interesting area, with the mouse. At the present time, I'm able to get the 
> coordinate mouse, to display some set of cross shapes, to draw
> lines between these shapes. But I was not able to make theses shapes moveable 
> with, for example, the use of DirectManipulationRendererJ3D.
> * The first solution I tried was to addReference, after the initial scene is 
> rendered. The code looks like:
> private void makeVisibleCrossShape (double dx, double dy) throws 
> VisADException, RemoteException {
>     // a cross is displayed at the current mouse coordinate
>     RealTuple point_coord_tuple = new RealTuple (xyzshapeType, new double[] 
> {dx, dy, 0, 0});
>     DataReferenceImpl point_ref = new DataReferenceImpl ("pointRef" + 
> pointCount);
>     point_ref.setData (point_coord_tuple);
>     // interactive behavior added
>     DirectManipulationRendererJ3D point_handler = new 
> DirectManipulationRendererJ3D ();
>     dpy.addReferences (point_handler, point_ref, pointColor);
>     System.out.println ("new cross in (" + dx + ", " + dy + ")");
>     pointCount++;
> }
> The reason why it doesn't work is probably that I don't have the right to use 
> addReference, once the scene has been displayed. Is it correct ?

No, this code should work. You should be able to drag these points
by clicking on them with the right mouse button and dragging (that's
right mouse button). Some of the tests provide examples, such as

If you want to drag the lines between points, then you need to
construct a CellImpl whose doAction() recomputes the lines, and
trigger the CellImpl with a cell.addReference(point_ref).

> * The second solution, I had in mind, was to create a DataReferenceImpl, 
> before the scene is rendered, that contains an array of cross shapes
> coordinates. By extending this array, I could add some shapes on the display. 
> Something like:
> (Gridded1DSet) -> (x, y, z, shape}
> But as soon as I add a DirectManipulationRendererJ3D to display this 
> reference, nothing appears (while with a classic Display#addreference
> call, everything is normally displayed).

DirectManipulationRendererJ3D doesn't know how to manipulate
a Field of discrete points (it can do fields like (x -> y)
depicted as continuous graphs).

Your first approach is the right one. Hopefully our Test
examples will help.

Good luck,
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

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