/** * Returns the number of ViewPlatformBehaviors on the ViewingPlatform */ int getViewPlatformBehaviorCount() { return behaviors.numChildren(); }
/** * Returns the avatarRoot child number of the ViewerAvatar object. * All the children of the avatarRoot are compared with the passed * in ViewerAvatar. If a match is found, the index is returned. * * @param avatar The ViewerAvatar object to look for in the avatarRoot's * child nodes. * @return The index of the child that corresponds to the ViewerAvatar. * If the avatarRoot does not contain the ViewerAvatar -1 is returned. */ private int findAvatarChild(ViewerAvatar avatar) { // Search the avatarRoot for the ViewerAvatar associated with // with the Viewer object for (int i = 0; i < avatarRoot.numChildren(); i++) { if (((ViewerAvatar)avatarRoot.getChild(i)) == avatar) return i; } // Should never get here. System.err.println("ViewingPlatform.findAvatarChild:Child not found."); return -1; }
if (platformGeometryRoot.numChildren() != 0) platformGeometryRoot.removeChild(0); if (platformGeometryRoot.numChildren() != 0) platformGeometryRoot.setChild(pg, 0); else {
/** * Removes the specified ViewPlatformBehavior */ void removeViewPlatformBehavior(ViewPlatformBehavior behavior) { // remove from the behaviors branch group if (behaviors != null) { behaviors.detach(); for (int i = 0; i < behaviors.numChildren(); i++) { if (behaviors.getChild(i) == behavior) { behavior.setViewingPlatform( null ); behaviors.removeChild(i); break; } } if (behaviors.numChildren() == 0) behaviors = null; else this.addChild(behaviors); } }
public void displayCase(Image3DUniverse univ, int caseNo) { System.out.println("Case no " + caseNo); int threshold = 120; BranchGroup scene = univ.getScene(); for(int i = scene.numChildren()-1; i >= 1 ; i--) { if (scene.getChild(i) instanceof BranchGroup) if (scene.getChild(i).getCapability(BranchGroup.ALLOW_DETACH)) scene.removeChild(i); } System.out.println("Nr. of contents:" + univ.getContents().size()); univ.removeAllContents(); createCase(caseNo); Volume volume = new Volume(image); List l = MCCube.getTriangles(volume, threshold); univ.addTriangleMesh(l, RED, "case" + caseNo); for(int z = 0; z < data.length; z++) { for(int y = 0; y < 2; y++) { for(int x = 0; x < 2; x++) { if(((int)data[z][y*2+x]&0xff)>=threshold) { addVertex(univ, RED, x, y, z); } else { addVertex(univ, GREY, x, y, z); } } } } }