📄 text3d.java
字号:
if(!this.getCapability(ALLOW_FONT3D_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D0")); return ((Text3DRetained)this.retained).getFont3D(); } /** * Sets the Font3D object used by this Text3D NodeComponent object. * * @param font3d the Font3D object to associate with this Text3D node. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setFont3D(Font3D font3d) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_FONT3D_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D1")); ((Text3DRetained)this.retained).setFont3D(font3d); } /** * Copies the character string used in the construction of the * Text3D node into the supplied parameter. * * @return a copy of the String object in this Text3D node. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public String getString() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_STRING_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D2")); return ((Text3DRetained)this.retained).getString(); } /** * Copies the character string from the supplied parameter into the * Text3D node. * * @param string the String object to recieve the Text3D node's string. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setString(String string) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_STRING_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D3")); ((Text3DRetained)this.retained).setString(string); } /** * Copies the node's <code>position</code> field into the supplied * parameter. The <code>position</code> is used to determine the * initial placement of the Text3D string. The position, combined with * the path and alignment control how the text is displayed. * * @param position the point to position the text. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #getAlignment * @see #getPath */ public void getPosition(Point3f position) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D4")); ((Text3DRetained)this.retained).getPosition(position); } /** * Sets the node's <code>position</code> field to the supplied * parameter. The <code>position</code> is used to determine the * initial placement of the Text3D string. The position, combined with * the path and alignment control how the text is displayed. * * @param position the point to position the text. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #getAlignment * @see #getPath */ public void setPosition(Point3f position) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D5")); ((Text3DRetained)this.retained).setPosition(position); } /** * Retrieves the text alignment policy for this Text3D NodeComponent * object. The <code>alignment</code> is used to specify how * glyphs in the string are placed in relation to the * <code>position</code> field. Valid values for this field * are: * <UL> * <LI> ALIGN_CENTER - the center of the string is placed on the * <code>position</code> point. * <LI> ALIGN_FIRST - the first character of the string is placed on * the <code>position</code> point. * <LI> ALIGN_LAST - the last character of the string is placed on the * <code>position</code> point. * </UL> * The default value of this field is <code>ALIGN_FIRST</code>. * * @return the current alingment policy for this node. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #getPosition */ public int getAlignment() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ALIGNMENT_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D6")); return ((Text3DRetained)this.retained).getAlignment(); } /** * Sets the text alignment policy for this Text3D NodeComponent * object. The <code>alignment</code> is used to specify how * glyphs in the string are placed in relation to the * <code>position</code> field. Valid values for this field * are: * <UL> * <LI> ALIGN_CENTER - the center of the string is placed on the * <code>position</code> point. * <LI> ALIGN_FIRST - the first character of the string is placed on * the <code>position</code> point. * <LI> ALIGN_LAST - the last character of the string is placed on the * <code>position</code> point. * </UL> * The default value of this field is <code>ALIGN_FIRST</code>. * * @param alignment specifies how glyphs in the string are placed * in relation to the position field * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #getPosition */ public void setAlignment(int alignment) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ALIGNMENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D7")); ((Text3DRetained)this.retained).setAlignment(alignment); } /** * Retrieves the node's <code>path</code> field. This field * is used to specify how succeeding * glyphs in the string are placed in relation to the previous glyph. * Valid values for this field are: * <UL> * <LI> PATH_LEFT: - succeeding glyphs are placed to the left of the * current glyph. * <LI> PATH_RIGHT: - succeeding glyphs are placed to the right of the * current glyph. * <LI> PATH_UP: - succeeding glyphs are placed above the current glyph. * <LI> PATH_DOWN: - succeeding glyphs are placed below the current glyph. * </UL> * The default value of this field is <code>PATH_RIGHT</code>. * * @return the current alingment policy for this node. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getPath() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PATH_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D8")); return ((Text3DRetained)this.retained).getPath(); } /** * Sets the node's <code>path</code> field. This field * is used to specify how succeeding * glyphs in the string are placed in relation to the previous glyph. * Valid values for this field are: * <UL> * <LI> PATH_LEFT - succeeding glyphs are placed to the left of the * current glyph. * <LI> PATH_RIGHT - succeeding glyphs are placed to the right of the * current glyph. * <LI> PATH_UP - succeeding glyphs are placed above the current glyph. * <LI> PATH_DOWN - succeeding glyphs are placed below the current glyph. * </UL> * The default value of this field is <code>PATH_RIGHT</code>. * * @param path the value to set the path to * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPath(int path) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PATH_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D9")); ((Text3DRetained)this.retained).setPath(path); } /** * Retrieves the 3D bounding box that encloses this Text3D object. * * @param bounds the object to copy the bounding information to. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see BoundingBox */ public void getBoundingBox(BoundingBox bounds) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_BOUNDING_BOX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D10")); ((Text3DRetained)this.retained).getBoundingBox(bounds); } /** * Retrieves the character spacing used to construct the Text3D string. * This spacing is in addition to the regular spacing between glyphs as * defined in the Font object. 1.0 in this space is measured as the * width of the largest glyph in the 2D Font. The default value is * 0.0. * * @return the current character spacing value * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getCharacterSpacing() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CHARACTER_SPACING_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D11")); return ((Text3DRetained)this.retained).getCharacterSpacing(); } /** * Sets the character spacing used when constructing the Text3D string. * This spacing is in addition to the regular spacing between glyphs as * defined in the Font object. 1.0 in this space is measured as the * width of the largest glyph in the 2D Font. The default value is * 0.0. * * @param characterSpacing the new character spacing value * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setCharacterSpacing(float characterSpacing) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CHARACTER_SPACING_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Text3D12")); ((Text3DRetained)this.retained).setCharacterSpacing(characterSpacing); } /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { Text3D t = new Text3D(); t.duplicateNodeComponent(this); return t; } /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in * this object). * * @param originalNodeComponent 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. * * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); Text3DRetained text = (Text3DRetained) originalNodeComponent.retained; Text3DRetained rt = (Text3DRetained) retained; Font3D font3D = text.getFont3D(); if (font3D != null) { rt.setFont3D(font3D); } String s = text.getString(); if (s != null) { rt.setString(s); } Point3f p = new Point3f(); text.getPosition(p); rt.setPosition(p); rt.setAlignment(text.getAlignment()); rt.setPath(text.getPath()); rt.setCharacterSpacing(text.getCharacterSpacing()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -