Excellent questions as usual.
> 1. the location of the yellow dot appears in the upper left hand
> corner. I would like the 'documents' variable to reflect the
> position of the green dot, not the yellow dot as it does now (the
> X and Y variables are already the same for the yellow and green
> dot);
The location strings are set in calls to setCursorStringVector
in DataRenderer.drag_direct. You could change these strings
by extending DirectManipulationRendererJ3D (which inherits
drag_direct from DataRenderer) and overriding drag_direct.
No day at the beach, but possible. You could define the new
drag_direct implementation by cutting and pasting source from
DataRenderer.drag_direct. Of course, drag_direct is onvoked
from a MouseEvent callback, whereas the position of the green
dot is computed in a CellImpl, so there might be a little
reorganization to communicate that position.
A much easier solution is to create your own display of the
green dot location as one or more JLabels. That is, text not
embedded in the 3-D display window. I'd be very open to
adding a mode flag for disabling the location display that
is embedded in the 3-D window.
> 2. I would like to constrain the green dot to remain on the surface.
> I can get close with this code
>
> RealTuple location=(RealTuple) direct_reference.getData();
> int x=(int) (((Real) location.getComponent(0)).getValue()+0.5);
> int y=(int) (((Real) location.getComponent(1)).getValue()+0.5);
> if ((x >= 0) && (x < table.getColumnCount()) &&
> (y >= 0) && (y < table.getRowCount()))
> {
> /* update green dot */
> }
>
> But this is not quite what I want. I still want to move the green
> dot if one of the variables (x,y) is within range but constrain it to
> the surface (0-39,0-29). Using Math.min and Math.max comes to mind
> but how do you use min and max in this context:
>
> Real[] pairs={(Real) location.getComponent(0),
> (Real) location.getComponent(1)};
> RealTuple pair=new RealTuple(pairs);
> Real value=(Real) self_organizing_map.evaluate(pair);
> value=(Real) value.add(new Real(1.0));
> Real[] triples={(Real) location.getComponent(0),
> (Real) location.getComponent(1),value};
This should work:
Real clip0 = (Real) location.getComponent(0);
clip0 = (Real) clip0.max(new Real(0.0));
clip0 = (Real) clip0.min(new Real(39.0));
Real clip1 = (Real) location.getComponent(1);
clip1 = (Real) clip1.max(new Real(0.0));
clip1 = (Real) clip1.min(new Real(29.0));
Real[] pairs={clip0, clip1};
RealTuple pair=new RealTuple(pairs);
Real value=(Real) self_organizing_map.evaluate(pair);
value=(Real) value.add(new Real(1.0));
Real[] triples={clip0, clip1, value};
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
whibbard@xxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html
"kill cross-platform Java by growing the polluted Java market"
- from an internal Microsoft planning document