NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Accessing points of the created geometry.

Hi Sunila And Pardeep,

> 1. We have created a 2D geometry by passing x and y values in the
> Gridded2DSet constructor and setting data to DataReference as UnionSet. We
> want both the points(of greater pixel size) and lines to be visible. Suggest
> us with this.
> 
> 2. Also, We want to access the points of the geometry created as above, say
> when a user clicks on points and drags them, the lines connecting them
> should move as the point moves.   Please suggest us about this.
> 
> 3. We want the display of the co-ordinates always visible. Is it possible?
> please advice.

To do these things, you will need to construct three different
types of Data objects all linked to your DisplayImplJ3D:

1. Lines:
Construct a UnionSet of Gridded2DSets with manifold dimension = 1
with MathType: Set(x, y). This is similar to the construction
in the visad.Delaunay.main() method for dim == 3. But that construction
is for an irregular topology (from a 3-D Delaunay), whereas you need
a gridded 2-D topology. Its not too hard: just think of the lines on
a 2-D checkerboard.

2. Coordinate labels:
Construct a FieldImpl with MathType: (t -> (x, y, text(Text))),
as again in the visad.Delaunay.main() method. Note if you run
'java visad.Delaunay 3 20 2 4' you will see an irregular 3-D
topology with labels on the vertices. Of course, you want to label
them with coordinates rather than index values.

3. Draggable vertices:
For each vertex, construct a RealTuple with MathType: (x, y)
and link to the DisplayImplJ3D and a set of CellImpls as follows:

  DataReferenceImpl[] dr = new DataReferenceImpl[nvertices];
  RealTuple[] real_tuple = new RealTuple[nvertices];
  for (int i=0; i<nvertices; i++) {
    real_tuple[i] = new RealTuple(xy, ...);
    DataReferenceImpl dr[i] = new DataReferenceImpl("dr" + i);
    dr[i].setData(real_tuple[i]);
    DirectManipulationRendererJ3D dmr = new DirectManipulationRendererJ3D();
    // greater pixel size
    ConstantMap[] cm = {new ConstantMap(4.0, Display.PointSize);
    display.addReferences(dmr, dr[i], cm);
    CellImpl cell = new CellImpl() {
      private boolean first = true;
      private int index = i;
      public void doAction() throws VisADException, RemoteException {
        if (first) first = false;
        else {
          // here process the fact that vertex number 'index' has moved
          RealTuple rt = (RealTuple) dr[index].getData(); // new location of 
vertex
          // need to reconstruct lines UnionSet, and
          // set (x, y, text(Text)) range value for this vertex
          // in labels FieldImpl
          . . .

        }
      }
    };
    cell.addReference(dr[i]);
  }

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


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