/** * Gets the bounding object of a node. * @return the node's bounding object */ @Override Bounds getBounds() { if ( boundsAutoCompute) { // Issue 514 : NPE in Wonderland : triggered in cached bounds computation if (validCachedBounds) { return (Bounds) cachedBounds.clone(); } // issue 544 Bounds boundingObject = null; if (VirtualUniverse.mc.useBoxForGroupBounds) { boundingObject = new BoundingBox((Bounds) null); } else { boundingObject = new BoundingSphere((Bounds)null); } for (int i = children.size() - 1; i >= 0; i--) { NodeRetained child = children.get(i); if (child != null) { child.computeCombineBounds(boundingObject); } } return boundingObject; } return super.getBounds(); }
/** * 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(); }