PickManinpulationRendererJ3D & Flow

Hi all,

I have a GriddedSet with 4 datareferences. Each datareference has arrows/flows in another direction and also a PickManipulationRendererJ3D. But if I click on the arrows, only the left one shoots an event and only a small piece of the arrow is sensitive. In attachment you can find a test program.
Someone a suggestion?

Regards,

Geert.
import visad.*;
import visad.java3d.*;
import visad.bom.*;
import java.rmi.*;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


class TestArrow3 {
        public static void main(String[] args) throws Exception {
                DisplayImpl display = new DisplayImplJ3D("display");

                RealType X = new RealType("Position X", null, null);
                ScalarMap Xmap = new ScalarMap(X, Display.XAxis);
                display.addMap(Xmap);

                RealType Y = new RealType("Position Y", null, null);
                ScalarMap Ymap = new ScalarMap(Y, Display.YAxis);
                display.addMap(Ymap);

                RealType Z = new RealType("Position Z", null, null);
                ScalarMap Zmap = new ScalarMap(Z, Display.ZAxis);
                display.addMap(Zmap);

                RealTupleType pos = new RealTupleType(X,Y,Z);

                RealType A = new RealType("VectorX", null, null);
                ScalarMap Amap = new ScalarMap(A, Display.Flow1X);
                display.addMap(Amap);

                RealType E = new RealType("VectorY", null, null);
                ScalarMap Emap = new ScalarMap(E, Display.Flow1Y);
                display.addMap(Emap);

                RealType Q = new RealType("VectorZ", null, null);
                ScalarMap Qmap = new ScalarMap(Q, Display.Flow1Z);
                display.addMap(Qmap);
                FlowControl fc = (FlowControl)Qmap.getControl();
                fc.setFlowScale(0.20f);

                RealTupleType vec = new RealTupleType(A,E,Q);

                FunctionType tuple = new FunctionType(pos,vec);

                for (int i=0;i<4;i++) {
                        DataReferenceImpl ref = new 
DataReferenceImpl("data_ref");                      
                        FlatField values_ff =  new FlatField(tuple, new 
Integer3DSet(5,5,1));
                        ref.setData(values_ff);

                        float[][] flat_samples = new float[3][25]; 

                        for (int j=0;j<25;j++) {
                                double rand = Math.random()-0.5;
                                //In the X or Y direction                       
-1 or 1
                                if (i%2==0)
                                        flat_samples[i/2][j] = -1.0f;
                                else
                                        flat_samples[i/2][j] = 1.0f;
                                flat_samples[2][j] = 0;
                        }

                        values_ff.setSamples(flat_samples); 

                        final PickManipulationRendererJ3D pmrset = new 
PickManipulationRendererJ3D();
                        display.addReferences(pmrset, ref);
                        
                        final String direction;

                        switch (i) {
                                case 0: direction = "Left"; break;
                                case 1: direction = "Right"; break;
                                case 2: direction = "Down"; break;
                                case 3: direction = "Up"; break;
                                default: direction = "Unknown";
                        }
                        
                        CellImpl cell = new CellImpl() {
                                private int prev = -1;
                                public void doAction() throws VisADException, 
RemoteException {
                                        int index = pmrset.getCloseIndex();
                                        if (prev!=index) {
                                                prev = index;
                                                System.out.println("Arrow: 
"+index+"\t"+direction);
                                        }
                                }
                        };
                        cell.addReference(ref);
                }
                GraphicsModeControl dispGMC = (GraphicsModeControl) 
display.getGraphicsModeControl();
                dispGMC.setScaleEnable(true);

                JFrame jf = new JFrame("Test Arrow");
                jf.getContentPane().add(display.getComponent());

                jf.pack();
                jf.setVisible(true);
        }
}
  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: