RE: Axis labeling and axis interaction

        hi again and thanks for your answer bill , ...
        but i have to ask again.

        >There are a couple of ways to create custom axis labels:

        >1. Extend visad.java3d.DefaultDisplayRendererJ3D, and override its
        >createSceneGraph() method to create your labels as part of your

        hm, sorry, but i have absolutely no idea how to do this. i already
took a look at the source code, but it didn't really help me. ok, i would
call super.createSceneGraph() in my subclass before doing something, but...

        >2. Create your labels as VisADLineArrays and put them in
        >ShapeControls for some RealType mapped to Display.Shape.  There's
        >an example in visad/bom/
        >In a DisplayImplJ3D the "box" spans X, Y and Z coordinates from
        >to 1.0.  You can use the visad.PlotText.render_label() method to
        >help you draw text for your labels.

        yes, i think i understood this, it's the creation you mentioned in
point one -isn't it?
        but how dow create them "as part of my box"? i also don't know what
realtype i should use for mapping.
        i tried the one i already mapped to the xaxis, but the labels where
plotted at the position of the data, of course. also a dummy realtype
doesn't really work, because they always seem to be plotted with a fixed y
value, so they don't stay on the x-axis when the plot is zoomed.

        >> - secondly i want these labels to be interactive: if the users
clicks a
        >> label, i want the corresponding 2D data to be displayed in a
seperate 2D
        >> display.
        >This is more difficult, but you can do it like this:
        >You can construct a DisplayListener and add it to your
        >DisplayImplJ3D.  In its displayChanged(DisplayEvent e)
        >method, if e.getId() == DisplayEvent.MOUSE_PRESSED (or
        >MOUSE_PRESSED_RIGHT if you want to respond to a specific
        >mouse button), get the cursor position by
        >DisplayEvent.getX() and DisplayEvent.getY().  Then you must
        >tranlate the cursor location into a ray in 3-D and figure
        >out which label the user is pointing at.  You'd do this
        >something like:
        >  DisplayImplJ3D display = ...
        >  DisplayRenderer dr = display.getDisplayRenderer();
        >  MouseBehavior mouse = dr.getMouseBehavior();
        >  VisADRay direct_ray = behavior.findRay(cursor_x, cursor_y);
        >Then use code similar to DisplayRendererJ3D.findDirect(direct_ray,
        >to figure out which label is closest to direct_ray (a 2-D cirsor
        >location generates a 3-D ray).
        >Note the DisplayRenderer.getMouseBehavior() method is new.
        didn't try this one by now.


        thanks again,


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