RE: Picking GriddedSets

Bill,
        I'd tried something similar to what you suggested, but the
problem with that is that it uses a lot of memory(I have a large data
set). Do you think there's another way I could implement this? Thanks a
lot for your help.
Ibrahim



-----Original Message-----
From: owner-visad-list@xxxxxxxxxxxxx
[mailto:owner-visad-list@xxxxxxxxxxxxx] On Behalf Of Bill Hibbard
Sent: Wednesday, February 26, 2003 5:15 AM
To: Ibrahim Z Mohammad
Subject: Re: Picking GriddedSets

Hi Ibrahim,

For a case like this you can't combine all your FlatFields
in one FieldImpl. getCloseIndex() is intended to give you
the index of a point in a FlatField, not the index of a
FlatField in a FieldImpl.

Instead, construct a DataReference, a PickManipulationRendererJ3D
and a CellImpl for each FlatField. Each FlatField is linked
independently to the DisplayImpl via its own DataReference and
PickManipulationRendererJ3D, and the DataReference is linked to
its own CellImpl that responds to picking that particular
FlatField.

Good luck,
Bill

On Tue, 25 Feb 2003, Ibrahim Z Mohammad wrote:

> Hi,
>             I've created a display with the following characteristics.
> First, I have a (x, y) -> w mapping in which I use Gridded2DSet to
> create many discrete 'blocks' and then color them. Then I use an index
> -> ((x,y) -> w) mapping to add all the data to one FieldImpl and then
> add it to the data reference.
> The code looks something like this
>
> index = RealType.getRealType("index", null, null);
> x = RealType.getRealType("X", null, null);
> y = RealType.getRealType("Y", null, null);
> xy = new RealTupleType(x, y);
> w = RealType.getRealType("W", null, null);
>
> blockFunc = new FunctionType(xyz, w);
> particlesFunc = new FunctionType(index, blockFunc);
>
> particlesSet = new Integer1DSet(index, numParticles);
> particlesField = new FieldImpl(particlesFunc, particlesSet);
>
>
> for(i = 0; i < numParticles; i++) {
> //Reuse the same 'Set' and 'Field' to add next block
> blockSet = new Gridded2DSet(xy, getCoords(i), mFold[0],mFold[1]);
> blockField = new FlatField(blockFunc, blockSet);
> blockField.setSamples(colorValues, false);
>
> particlesField.setSample(i, blockField, false);
> }
>
> xMap = new ScalarMap(x, Display.XAxis);
> yMap = new ScalarMap(y, Display.YAxis);
> rgbMap = new ScalarMap(w, Display.RGB);
>
> particlesRef = new DataReferenceImpl("Particles_ref");
> particlesRef.setData(particlesField);
>
> I need now to be able to pick those GriddedSets from the display to
> identify them. Basically, I need the index, or the 'i' of the
GriddedSet
> from the display. I've tried using PickManipulationRenderJ3D using the
> following code after looking at some responses in the archives:
>
> final PickManipulationRendererJ3D pmrset = new
> PickManipulationRendererJ3D();
> display.addReferences(pmrset, particlesRef);
>
> CellImpl cell = new CellImpl() {
> public void doAction() throws VisADException, RemoteException {
> int index = pmrset.getCloseIndex();
> System.out.println("index: " + index);
> }
> };
> cell.addReference(particlesRef);
>
> But the call to doAction() is not being called when I right-click on
the
> display. Is there something wrong with what I'm doing? Also, I'm not
> sure of how to use the index from getCloseIndex() to retrieve the 'i'
> value that I need. Any help would be greatly appreciated. Thanks a
lot!
>
> Ibrahim
>
>
>
>



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