I have a MouseRotate class which extends Java3D's MouseBehavior class. This class allows users to rotate my 3D image using left mouse within the specified x and y ranges so that the users can not see the bottom of my image. The Java3D's MouseRotate class allows users to view the image from any angles using left mouse, the same for the default VisADmouse behavior. Now I want to apply my own MouseRotate class to my DisplayImplJ3D, i.e., I do not want to use the default mouse behavior of VisAD. I searched VisADemail archive and found Bill's message on 26 Jul 1999. So I followed what Bill said and added the following code to my program:
DisplayRendererJ3D display_renderer = (DisplayRendererJ3D) display.getDisplayRenderer();TransformGroup trans = display_renderer.getTrans();if(trans == null) System.out.println("trans is empty");MouseRotate my_mouse = new MouseRotate();BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 200000000.0);my_mouse.setTransformGroup(trans);my_mouse.setSchedulingBounds(bounds);
BranchGroup group = new BranchGroup();Group.addChild(my_mouse);trans.addChild(group);
After I run my program, I still can rotate and zoom the image as before, i.e., these codesdo not do anything.
Any help will be highly appreciated.