⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alternateappearance.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * bounds.  This allows them to be further scoped by a list of     * nodes in the hierarchy.     * @param scope the Group node to be inserted at the specified index.     * @param index the index at which the Group node is inserted.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     * @exception RestrictedAccessException if the specified group node     * is part of a compiled scene graph     */    public void insertScope(Group scope, int index) {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance9"));	if (isLive())	    ((AlternateAppearanceRetained)this.retained).insertScope(scope, index);	else	    ((AlternateAppearanceRetained)this.retained).initInsertScope(scope, index);    }    /**     * Removes the node at the specified index from this AlternateAppearance     * node's     * list of scopes.  If this operation causes the list of scopes to     * become empty, then this AlternateAppearance will have universe scope:     * all nodes     * within the region of influence will be affected by this     * AlternateAppearance node.     * @param index the index of the Group node to be removed.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     * @exception RestrictedAccessException if the group node at the     * specified index is part of a compiled scene graph     */    public void removeScope(int index) {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance10"));	if (isLive())	    ((AlternateAppearanceRetained)this.retained).removeScope(index);	else	    ((AlternateAppearanceRetained)this.retained).initRemoveScope(index);    }    /**     * Returns an enumeration of this AlternateAppearance node's list     * of scopes.     * @return an Enumeration object containing all nodes in this     * AlternateAppearance node's list of scopes.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public Enumeration getAllScopes() {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance11"));	return (Enumeration) ((AlternateAppearanceRetained)this.retained).getAllScopes();    }    /**     * Appends the specified Group node to this AlternateAppearance node's     * list of scopes.     * By default, AlternateAppearance nodes are scoped only by their     * influencing     * bounds.  This allows them to be further scoped by a list of     * nodes in the hierarchy.     * @param scope the Group node to be appended.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     * @exception RestrictedAccessException if the specified group node     * is part of a compiled scene graph     */    public void addScope(Group scope) {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance12"));	if (isLive())	    ((AlternateAppearanceRetained)this.retained).addScope(scope);	else	    ((AlternateAppearanceRetained)this.retained).initAddScope(scope);    }    /**     * Returns the number of nodes in this AlternateAppearance node's list     * of scopes.     * If this number is 0, then the list of scopes is empty and this     * AlternateAppearance node has universe scope: all nodes within the     * region of     * influence are affected by this AlternateAppearance node.     * @return the number of nodes in this AlternateAppearance node's list     * of scopes.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int numScopes() {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance11"));	return ((AlternateAppearanceRetained)this.retained).numScopes();    }    /**     * Retrieves the index of the specified Group node in this     * AlternateAppearance node's list of scopes.     *     * @param scope the Group node to be looked up.     * @return the index of the specified Group node;     * returns -1 if the object is not in the list.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public int indexOfScope(Group scope) {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance8"));	return ((AlternateAppearanceRetained)this.retained).indexOfScope(scope);    }    /**     * Removes the specified Group node from this AlternateAppearance     * node's list of scopes.  If the specified object is not in the     * list, the list is not modified.  If this operation causes the     * list of scopes to become empty, then this AlternateAppearance     * will have universe scope: all nodes within the region of     * influence will be affected by this AlternateAppearance node.     *     * @param scope the Group node to be removed.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     * @exception RestrictedAccessException if the specified group node     * is part of a compiled scene graph     *     * @since Java 3D 1.3     */    public void removeScope(Group scope) {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance10"));	if (isLive())	    ((AlternateAppearanceRetained)this.retained).removeScope(scope);	else	    ((AlternateAppearanceRetained)this.retained).initRemoveScope(scope);    }    /**     * Removes all Group nodes from this AlternateAppearance node's     * list of scopes.  The AlternateAppearance node will then have     * universe scope: all nodes within the region of influence will     * be affected by this AlternateAppearance node.     *     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     * @exception RestrictedAccessException if any group node in this     * node's list of scopes is part of a compiled scene graph     *     * @since Java 3D 1.3     */    public void removeAllScopes() {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_SCOPE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance10"));	if (isLive())	    ((AlternateAppearanceRetained)this.retained).removeAllScopes();	else	    ((AlternateAppearanceRetained)this.retained).initRemoveAllScopes();    }   /**    * Copies all AlternateAppearance information from    * <code>originalNode</code> into    * the current node.  This method is called from the    * <code>cloneNode</code> method which is, in turn, called by the    * <code>cloneTree</code> method.<P>    *    * @param originalNode the original node to duplicate.    * @param forceDuplicate when set to <code>true</code>, causes the    *  <code>duplicateOnCloneTree</code> flag to be ignored.  When    *  <code>false</code>, the value of each node's    *  <code>duplicateOnCloneTree</code> variable determines whether    *  NodeComponent data is duplicated or copied.    *    * @exception RestrictedAccessException if this object is part of a live    *  or compiled scenegraph.    *    * @see Node#duplicateNode    * @see Node#cloneTree    * @see NodeComponent#setDuplicateOnCloneTree    */    void duplicateAttributes(Node originalNode, boolean forceDuplicate) {	super.duplicateAttributes(originalNode, forceDuplicate);	AlternateAppearanceRetained attr = (AlternateAppearanceRetained) 	                                   originalNode.retained;	AlternateAppearanceRetained rt = (AlternateAppearanceRetained) retained;	rt.initAppearance((Appearance) getNodeComponent(						       attr.getAppearance(), 						       forceDuplicate,						       originalNode.nodeHashtable));		rt.initInfluencingBounds(attr.getInfluencingBounds());	Enumeration elm = attr.getAllScopes();	while (elm.hasMoreElements()) {	  // this reference will set correctly in updateNodeReferences() callback	    rt.initAddScope((Group) elm.nextElement());	}		// correct value will set in updateNodeReferences	rt.initInfluencingBoundingLeaf(attr.getInfluencingBoundingLeaf());    }    /**     * Callback used to allow a node to check if any nodes referenced     * by that node have been duplicated via a call to <code>cloneTree</code>.     * This method is called by <code>cloneTree</code> after all nodes in     * the sub-graph have been duplicated. The cloned Leaf node's method     * will be called and the Leaf node can then look up any node references     * by using the <code>getNewObjectReference</code> method found in the     * <code>NodeReferenceTable</code> object.  If a match is found, a     * reference to the corresponding Node in the newly cloned sub-graph     * is returned.  If no corresponding reference is found, either a     * DanglingReferenceException is thrown or a reference to the original     * node is returned depending on the value of the     * <code>allowDanglingReferences</code> parameter passed in the     * <code>cloneTree</code> call.     * <p>     * NOTE: Applications should <i>not</i> call this method directly.     * It should only be called by the cloneTree method.     *     * @param referenceTable a NodeReferenceTableObject that contains the     *  <code>getNewObjectReference</code> method needed to search for     *  new object instances.     * @see NodeReferenceTable     * @see Node#cloneTree     * @see DanglingReferenceException     */    public void updateNodeReferences(NodeReferenceTable referenceTable) {	AlternateAppearanceRetained rt = (AlternateAppearanceRetained)                                   	  retained;        BoundingLeaf bl = rt.getInfluencingBoundingLeaf();	        if (bl != null) {            Object o = referenceTable.getNewObjectReference(bl);            rt.initInfluencingBoundingLeaf((BoundingLeaf) o);        }	int num = rt.numScopes();	for (int i=0; i < num; i++) {	    rt.initScope((Group) referenceTable.			 getNewObjectReference(rt.getScope(i)), i);	}   }    /**     * Used to create a new instance of the node.  This routine is called     * by <code>cloneTree</code> to duplicate the current node.     * @param forceDuplicate when set to <code>true</code>, causes the     *  <code>duplicateOnCloneTree</code> flag to be ignored.  When     *  <code>false</code>, the value of each node's     *  <code>duplicateOnCloneTree</code> variable determines whether     *  NodeComponent data is duplicated or copied.     *     * @see Node#cloneTree     * @see Node#cloneNode     * @see Node#duplicateNode     * @see NodeComponent#setDuplicateOnCloneTree     */    public Node cloneNode(boolean forceDuplicate) {        AlternateAppearance app = new AlternateAppearance();        app.duplicateNode(this, forceDuplicate);        return app;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -