Example usage for javax.media.j3d SceneGraphObject setUserData

List of usage examples for javax.media.j3d SceneGraphObject setUserData

Introduction

In this page you can find the example usage for javax.media.j3d SceneGraphObject setUserData.

Prototype

public void setUserData(Object userData) 

Source Link

Document

Sets the userData field associated with this scene graph object.

Usage

From source file:PickCollisionTest.java

void recursiveSetUserData(SceneGraphObject root, Object value) {
    root.setUserData(value);

    // recursively process group
    if (root instanceof Group) {
        Group g = (Group) root;

        // recurse on child nodes
        java.util.Enumeration enumKids = g.getAllChildren();

        while (enumKids.hasMoreElements() != false)
            recursiveSetUserData((SceneGraphObject) enumKids.nextElement(), value);
    }//from w  ww  .  j  a  v a 2s .co  m
}

From source file:VrmlPickingTest.java

void recursiveSetUserData(Object value, Object key) {
    if (value instanceof SceneGraphObject != false) {
        // set the user data for the item
        SceneGraphObject sg = (SceneGraphObject) value;
        sg.setUserData(key);

        // recursively process group
        if (sg instanceof Group) {
            Group g = (Group) sg;

            // recurse on child nodes
            java.util.Enumeration enumKids = g.getAllChildren();

            while (enumKids.hasMoreElements() != false)
                recursiveSetUserData(enumKids.nextElement(), key);
        } else if (sg instanceof Shape3D || sg instanceof Morph) {
            PickTool.setCapabilities((Node) sg, PickTool.INTERSECT_FULL);
        }//from  w  w  w . j  av  a2s  .  c om
    }
}