[OpenMap Users] Adding MouseBehavior to 3D scenes

From: Sebastien Rosset <srosset_at_cougaarsoftware.com>
Date: Tue, 9 Aug 2005 09:27:53 -0700

I am experimenting with the Openmap 3D viewer, which works pretty well. I
have added MouseBehavior (zoom, translation, rotation), which was
straightforward, but my solution requires some modifications to the openmap
code base. I am not an expert of J3D, and I do not know if there are ways to
add mouse behavior without modifying the openmap source code. Anyway, here
is a sketch of how it works (using J3D v1.3.2): first, I had to modify the
MapContentManager constructor, so that the compilation of the universe is
skipped. Instead, the universe compilation is done in a separate method that
needs to be invoked after the mouse behavior has been added. This allows
adding a MouseBehavior before the universe is compiled, otherwise J3D throws
an exception (maybe there are ways to do this after the universe has been
compiled?). Second, I create instances of a MouseTranslate, MouseZoom,
MouseWheelZoom and MouseRotate classes. These classes need a TransformGroup,
and I thought using MapContentManager.getCamera().getNode() would be a good
candidate, but the getNode() method is currently protected, so I made it
public. Once the MouseBehaviors have been instantiated, I simply add them as
children to MapContentManager.getWorld(), then compile the universe, and
voila, the user can navigate using the mouse.


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Aug 09 2005 - 12:36:46 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT