/** * Sets the geometric bounds of a node. * @param bounds the bounding object for a node * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setBounds(Bounds bounds) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Node1")); ((NodeRetained)this.retained).setBounds(bounds); }
/** * Sets the collidable value; determines whether this node and any of its * children, if a group node, can be considered for collision purposes. * @param collidable the new collidable value for this node */ public void setCollidable( boolean collidable ) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLLIDABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Node4")); ((NodeRetained)retained).setCollidable(collidable); }
/** * Gets the value indicating if the automatic calcuation of geometric bounds of a node is on/off. * @return the node's auto compute flag for the geometric bounding object * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getBoundsAutoCompute() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_AUTO_COMPUTE_BOUNDS_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node6")); return ((NodeRetained)this.retained).getBoundsAutoCompute(); }
/** * Returns true if this <code>Node</code> is pickable, * false if it is not pickable. */ public boolean getPickable() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PICKABLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node3")); return ((NodeRetained)retained).getPickable(); }
/** * Turns the automatic calcuation of geometric bounds of a node on/off. * @param autoCompute indicates if the node's bounding object is * automatically computed. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setBoundsAutoCompute(boolean autoCompute) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_AUTO_COMPUTE_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Node5")); ((NodeRetained)this.retained).setBoundsAutoCompute(autoCompute); }
/** * When set to <code>true</code> this <code>Node</code> can be Picked. * Setting to false indicates that this node and it's children * are ALL unpickable. * * @param pickable Indicates if this node should be pickable or not */ public void setPickable( boolean pickable ) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PICKABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Node14")); ((NodeRetained)retained).setPickable(pickable); }
/** * Returns the collidable value; this value determines whether this node * and it's children, if a group node, can be considered for collision * purposes; if it is set to false, then neither this node nor any * children nodes will be traversed for collision purposes; the default * value is true. The collidable setting is the way that an * application can perform collision culling. * @return the present collidable value for this node */ public boolean getCollidable() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLLIDABLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node16")); return ((NodeRetained)retained).getCollidable(); }
/** * @return the parent of this node, or null if this node has no parent * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public Node getParent() { if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_PARENT_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("Node0")); } } NodeRetained nr = ((NodeRetained)this.retained).getParent(); return (nr == null ? null : (Node) nr.getSource()); }
/** * Retrieves the locale to which this node is attached. If the * node is not part of a live scene graph, null is returned. * * @return the locale to which this node is attached. * * @exception CapabilityNotSetException if appropriate capability is * not set and this node is part of live scene graph * @exception IllegalSharingException if the node is a descendant * of a SharedGroup node. * * @since Java 3D 1.4 */ public Locale getLocale() { if (!isLive()) { return null; } if(!this.getCapability(ALLOW_LOCALE_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("Node17")); } return ((NodeRetained)this.retained).getLocale(); }
/** * Returns the bounding object of a node. * @return the node's bounding object * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception SceneGraphCycleException if there is a cycle in the * scene graph */ public Bounds getBounds() { if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_BOUNDS_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("Node2")); } } else { // this will throw a SceneGraphCycleException if there is // a cycle checkForCycle(); } return ((NodeRetained)this.retained).getBounds(); }
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); } } } } }
/** * Retrieves the local coordinates to virtual world coordinates * transform for the particular path in the scene graph ending with * this node. This is the composite * of all transforms in the scene graph from the root down to * <code>this</code> node via the specified Link nodes. It is * only valid for nodes that are part of a live scene graph. * @param path the specific path from the node to the Locale * @param t the object that will receive the local coordinates to * Vworld coordinates transform. * @exception RestrictedAccessException if the node is <em>not</em> * part of a live scene graph * @exception CapabilityNotSetException if appropriate capability is * not set and this node is part of live scene graph * @exception IllegalArgumentException if the specified path does * not contain a valid Locale, or if the last node in the path is * different from this node * @exception IllegalSharingException if the node is not a descendant * of a SharedGroup node. */ public void getLocalToVworld(SceneGraphPath path, Transform3D t) { if (!isLive()) { throw new RestrictedAccessException(J3dI18N.getString("Node7")); } if(!this.getCapability(ALLOW_LOCAL_TO_VWORLD_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node8")); ((NodeRetained)this.retained).getLocalToVworld(path,t); }
if(!this.getCapability(ALLOW_LOCAL_TO_VWORLD_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node8"));
if (!pickNode.getCapability(Shape3D.ALLOW_GEOMETRY_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("PickInfo0")); if (!pickNode.getCapability(Morph.ALLOW_GEOMETRY_ARRAY_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("PickInfo6"));