Re: using shapes for markers in 2 dimensions

  • To: Donna L Gresh <gresh@xxxxxxxxxx>
  • Subject: Re: using shapes for markers in 2 dimensions
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Tue, 25 Feb 2003 16:05:26 -0600 (CST)
Hi Donna,

> I need to place a "marker" on a 2D display (actually one created with
>   theDisplay = new DisplayImplJ3D("thedisplay", new
> TwoDDisplayRendererJ3D());)
>
> I am attempting to use Display.Shape, defining, say, a square to mark my xy
> point.  I'm only intending to put one shape on the plot. So for my marker
> I'm doing something like FunctionType xy->mark, and I create an extremely
> simple flat field with just one point: XY-> 1.0  I map mark to both
> Display.Shape and Display.ShapeScale, and I map x and y to Display.x and
> Display.y. I'm getting the square showing up in the right place, but I
> can't figure out how to control its size (or even where it's size is coming
> from). I would have thought since I define my square shape with a size of
> 2, and my data value is 1, that the mark would be of a size 2, but it's
> not.

You may need to call setRange(0.01, 1.0) for your ScalarMap
to ShapeScale. In place of your FlatField, you could try a
RealTuple with MathType (x, y, mark, scale). That would let
you experiment with various values of scale (mapped to
ShapeScale).

> Also, I need the shape to show up *in front* of a surface I'm drawing, but
> it's showing up behind it.
> Any ideas?

Instead of using TwoDDisplayRendererJ3D, try:

  GraphicsModeControl mode = display.getGraphicsModeControl();
  mode.setProjectionPolicy(DisplayImplJ3D.PARALLEL_PROJECTION);

Then use z values (mapped to ZAxis) to determine what's in front.
You may also want to use the MouseHelper.setFunctionMap() method
to disable rotation (see visad/examples/Test00.java for an example).

Good luck,
Bill


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