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

📄 abstracttextdescriptor.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	public static void setNodeTextDescriptor(AbstractTextDescriptor td) { cacheNodeDescriptor.setTextDescriptor(td); }	/**	 * Method to factory reset the TextDescriptor for Variables on NodeInsts.	 */	public static void factoryResetNodeTextDescriptor() { cacheNodeDescriptor.factoryReset(); }	/**	 * Default TextDescriptor for ArcInsts is 1 unit tall.	 */	/*package*/ static final DescriptorPref cacheArcDescriptor = new DescriptorPref("Arc", 4);	/**	 * Method to set a TextDescriptor that is a default for Variables on ArcInsts.	 * @param td the default TextDescriptor for Variables on ArcInsts.	 */	public static void setArcTextDescriptor(AbstractTextDescriptor td) { cacheArcDescriptor.setTextDescriptor(td); }	/**	 * Method to factory reset the TextDescriptor for Variables on ArcInsts.	 */	public static void factoryResetArcTextDescriptor() { cacheArcDescriptor.factoryReset(); }	/**	 * Default TextDescriptor for Exports and Ports is 2 units tall.	 */	/*package*/ static final DescriptorPref cacheExportDescriptor = new DescriptorPref("Export", 8);	/**	 * Method to set a TextDescriptor that is a default for Variables on Exports.	 * @param td the default TextDescriptor for Variables on Exports.	 */	public static void setExportTextDescriptor(AbstractTextDescriptor td) { cacheExportDescriptor.setTextDescriptor(td); }	/**	 * Method to factory reset the TextDescriptor for Variables on Exports.	 */	public static void factoryResetExportTextDescriptor() { cacheExportDescriptor.factoryReset(); }	/**	 * Default TextDescriptor for Annotations is 1 unit tall.	 */	/*package*/ static final DescriptorPref cacheAnnotationDescriptor = new DescriptorPref("Annotation", 4);	/**	 * Method to set a TextDescriptor that is a default for Variables on Annotations.	 * @param td the default TextDescriptor for Variables on Annotations.	 */	public static void setAnnotationTextDescriptor(AbstractTextDescriptor td) { cacheAnnotationDescriptor.setTextDescriptor(td); }	/**	 * Method to factory reset the TextDescriptor for Variables on Annotations.	 */	public static void factoryResetAnnotationTextDescriptor() { cacheAnnotationDescriptor.factoryReset(); }	/**	 * Default TextDescriptor for Cell Instance Names is 4 units tall.	 */	/*package*/ static final DescriptorPref cacheInstanceDescriptor = new DescriptorPref("Instance", 16);	/**	 * Method to set a TextDescriptor that is a default for Variables on Cell Instance Names.	 * @param td the default TextDescriptor for Variables on Cell Instance Names.	 */	public static void setInstanceTextDescriptor(AbstractTextDescriptor td) { cacheInstanceDescriptor.setTextDescriptor(td); }	/**	 * Method to factory reset the TextDescriptor for Variables on Cell Instance Names.	 */	public static void factoryResetInstanceTextDescriptor() { cacheInstanceDescriptor.factoryReset(); }	/**	 * Default TextDescriptor for Cell Variables is 1 unit tall.	 */	/*package*/ static final DescriptorPref cacheCellDescriptor = new DescriptorPref("Cell", 4);	/**	 * Method to set a TextDescriptor that is a default for Variables on Cells.	 * @param td the default TextDescriptor for Variables on Cells.	 */	public static void setCellTextDescriptor(AbstractTextDescriptor td) { cacheCellDescriptor.setTextDescriptor(td); }	/**	 * Method to factory reset the TextDescriptor for Variables on Cells.	 */	public static void factoryResetCellTextDescriptor() { cacheCellDescriptor.factoryReset(); }    /**     * Returns a hash code for this <code>TextDescriptor</code>.     * @return  a hash code value for this TextDescriptor.	 */    @Override    public int hashCode() {		return lowLevelGet0()^lowLevelGet1()^getColorIndex()^getDisplay().hashCode();    }    /**     * Compares this text descriptor to the specified object.     * The result is <code>true</code> if and only if the argument is not     * <code>null</code> and is a <code>TextDescriptor</code> object with     * the same fields.     *     * @param   anObject   the object to compare this <code>TextDescriptor</code>     *                     against.     * @return  <code>true</code> if the <code>TextDescriptor</code> are equal;     *          <code>false</code> otherwise.     */    @Override    public boolean equals(Object anObject) {		if (this == anObject) {			return true;		}		if (anObject instanceof AbstractTextDescriptor) {    		AbstractTextDescriptor td = (AbstractTextDescriptor)anObject;            return lowLevelGet() == td.lowLevelGet() && getColorIndex() == td.getColorIndex() &&                    getDisplay() == td.getDisplay();		}		return false;    }	/**	 * Low-level method to get the bits in the TextDescriptor.	 * These bits are a collection of flags that are more sensibly accessed	 * through special methods.	 * This general access to the bits is required because the ELIB	 * file format stores it as a full integer.	 * This should not normally be called by any other part of the system.	 * @return the bits in the TextDescriptor.	 */	public abstract long lowLevelGet();	/**	 * Low-level method to get the first word of the bits in the TextDescriptor.	 * These bits are a collection of flags that are more sensibly accessed	 * through special methods.	 * This general access to the bits is required because the ELIB	 * file format stores it as a full integer.	 * This should not normally be called by any other part of the system.	 * @return the first word of the bits in the TextDescriptor.	 */	public int lowLevelGet0() { return (int)lowLevelGet(); }	/**	 * Low-level method to get the second word of the bits in the TextDescriptor.	 * These bits are a collection of flags that are more sensibly accessed	 * through special methods.	 * This general access to the bits is required because the ELIB	 * file format stores it as a full integer.	 * This should not normally be called by any other part of the system.	 * @return the second word of the bits in the TextDescriptor.	 */	public int lowLevelGet1() { return (int)(lowLevelGet() >> 32); }    private int getField(long mask, int shift) { return (int)((lowLevelGet() & mask) >> shift); }    private boolean isFlag(long mask) { return (lowLevelGet() & mask) != 0; }	/**	 * Method to return mode how this TextDescriptor is displayable.	 * @return Display mode how this TextDescriptor is displayable.	 */	public abstract Display getDisplay();	/**	 * Method to return true if this TextDescriptor is displayable.	 * @return true if this TextDescriptor is displayable.	 */	public boolean isDisplay() {        return getDisplay() == Display.SHOWN;    }	/**	 * Method to return the text position of the TextDescriptor.	 * The text position describes the "anchor point" of the text,	 * which is the point on the text that is attached to the object and does not move.	 * @return the text position of the TextDescriptor.	 */	public Position getPos()	{		int pos = getField(VTPOSITION, VTPOSITIONSH);		if (pos >= Position.getNumPositions()) pos = 0;		return Position.getPositionAt(pos);	}	/**	 * Returns true if this ImmutableTextDescriptor describes absolute text.	 * Text may be either absolute text (in points) or relative text (in quarter units).	 * @return true if this ImmutableTextDescriptor describes absolute text.	 */	public boolean isAbsoluteSize() {		int textSize = getField(VTSIZE, VTSIZESH);        return textSize > 0 && textSize <= Size.TXTMAXPOINTS;	}	/**	 * Method to return the text size of the text in this TextDescriptor.	 * This is a Size object that can describe either absolute text (in points)	 * or relative text (in quarter units).	 * @return the text size of the text in this TextDescriptor.	 */	public Size getSize()	{		int textSize = getField(VTSIZE, VTSIZESH);		if (textSize == 0) return Size.newRelSize(1);		if (textSize <= Size.TXTMAXPOINTS) return Size.newAbsSize(textSize);		int sizeValue = textSize>>Size.TXTQGRIDSH;		double size = sizeValue * 0.25;		return Size.newRelSize(size);	}	public static int getDefaultFontSize() { return Size.DEFAULT_FONT_SIZE; }	/**	 * Method to find the true size in points for this TextDescriptor in a given EditWindow0.	 * If the TextDescriptor is already Absolute (in points) nothing needs to be done.	 * Otherwise, the scale of the EditWindow0 is used to determine the acutal point size.	 * @param wnd the EditWindow0 in which drawing will occur.	 * @return the point size of the text described by this TextDescriptor.	 */	public double getTrueSize(EditWindow0 wnd)	{        if (wnd != null)            return getTrueSize(wnd.getScale(), wnd);		int textSize = getField(VTSIZE, VTSIZESH);        double trueSize = textSize > 0 && textSize <= Size.TXTMAXPOINTS ? textSize : Size.DEFAULT_FONT_SIZE;		return trueSize*User.getGlobalTextScale();	}	/**	 * Method to find the true size in points for this TextDescriptor in a given scale.	 * If the TextDescriptor is already Absolute (in points) nothing needs to be done.	 * Otherwise, the scale is used to determine the acutal point size.	 * @param scale scale to draw.	 * @param wnd the EditWindow0 in which drawing will occur.	 * @return the point size of the text described by this TextDescriptor.	 */	public double getTrueSize(double scale, EditWindow0 wnd)	{		double trueSize;		int textSize = getField(VTSIZE, VTSIZESH);		if (textSize == 0) {            // relative 1            trueSize = scale;        } else if (textSize <= Size.TXTMAXPOINTS) {            // absolute            trueSize = textSize;        } else {            // relative            trueSize = (textSize>>Size.TXTQGRIDSH) * 0.25 * scale;        }		return trueSize * (wnd == null ? User.getGlobalTextScale() : wnd.getGlobalTextScale());	}	/**	 * Method to return the text font of the TextDescriptor.	 * @return the text font of the TextDescriptor.	 */	public int getFace() { return getField(VTFACE, VTFACESH); }	/**	 * Method to get a Font to use for this TextDescriptor in a given EditWindow.	 * @param wnd the EditWindow0 in which drawing will occur.     * @param minimalTextSize Return null for texts smaller than this     * @return the Font to use (returns null if the text is too small to display).	 */    public Font getFont(EditWindow0 wnd, int minimalTextSize) {        int fontStyle = Font.PLAIN;        String fontName = User.getDefaultFont();        int size = (int)getTrueSize(wnd);        if (size <= 0) size = 1;        if (size < minimalTextSize) return null;        if (isItalic()) fontStyle |= Font.ITALIC;        if (isBold()) fontStyle |= Font.BOLD;        int fontIndex = getFace();        if (fontIndex != 0) {            TextDescriptor.ActiveFont af = TextDescriptor.ActiveFont.findActiveFont(fontIndex);            if (af != null) fontName = af.getName();        }        Font font = new Font(fontName, fontStyle, size);        return font;    }	/**	 * Method to get a default Font to use.	 * @return the Font to use (returns null if the text is too small to display).	 */	public static Font getDefaultFont()	{		return new Font(User.getDefaultFont(), Font.PLAIN, TextDescriptor.getDefaultFontSize());	}	/**	 * Method to convert a string and descriptor to a GlyphVector.	 * @param text the string to convert.	 * @param font the Font to use.	 * @return a GlyphVector describing the text.	 */	public static GlyphVector getGlyphs(String text, Font font)	{		// make a glyph vector for the desired text		FontRenderContext frc = new FontRenderContext(null, false, false);		GlyphVector gv = font.createGlyphVector(frc, text);		return gv;	}	/**	 * Method to return the text rotation of the TextDescriptor.	 * There are only 4 rotations: 0, 90 degrees, 180 degrees, and 270 degrees.	 * @return the text rotation of the TextDescriptor.	 */	public Rotation getRotation() { return Rotation.getRotationAt(getField(VTROTATION, VTROTATIONSH)); }	/**	 * Method to return the text display part of the TextDescriptor.	 * @return the text display part of the TextDescriptor.	 */	public DispPos getDispPart() { return DispPos.getShowStylesAt(getField(VTDISPLAYPART, VTDISPLAYPARTSH)); }	/**	 * Method to return true if the text in the TextDescriptor is italic.	 * @return true if the text in the TextDescriptor is italic.	 */	public boolean isItalic() { return isFlag(VTITALIC); }	/**	 * Method to return true if the text in the TextDescriptor is bold.	 * @return true if the text in the TextDescriptor is bold.	 */	public boolean isBold() { return isFlag(VTBOLD); }	/**	 * Method to return true if the text in the TextDescriptor is underlined.	 * @return true if the text in the TextDescriptor is underlined.	 */	public boolean isUnderline() { return isFlag(VTUNDERLINE); }	/**	 * Method to return true if the text in the TextDescriptor is interior.	 * Interior text is not seen at higher levels of the hierarchy.	 * @return true if the text in the TextDescriptor is interior.	 */	public boolean isInterior() { return isFlag(VTINTERIOR); }	/**	 * Method to return true if the text in the TextDescriptor is inheritable.	 * Inheritable variables copy their contents from prototype to instance.	 * Only Variables on NodeProto and PortProto objects can be inheritable.	 * When a NodeInst is created, any inheritable Variables on its NodeProto are automatically	 * created on that NodeInst.	 * @return true if the text in the TextDescriptor is inheritable.	 */	public boolean isInherit() { return isFlag(VTINHERIT); }	/**	 * Method to return true if the text in the TextDescriptor is a parameter.	 * Parameters are those Variables that have values on instances which are	 * passed down the hierarchy into the contents.	 * Parameters can only exist on NodeInst objects.	 * @return true if the text in the TextDescriptor is a parameter.	 */	public boolean isParam() { return isFlag(VTISPARAMETER); }	/**	 * Method to return the X offset of the text in the TextDescriptor.	 * @return the X offset of the text in the TextDescriptor.	 */	public double getXOff()	{		int offset = getField(VTXOFF, VTXOFFSH);		if (isFlag(VTXOFFNEG)) offset = -offset;		int scale = getOffScale() + 1;		return((double)offset * scale / 4);	}	/**	 * Method to return the Y offset of the text in the TextDescriptor.	 * @return the Y offset of the text in the TextDescriptor.	 */	public double getYOff()	{		int offset = getField(VTYOFF, VTYOFFSH);		if (isFlag(VTYOFFNEG)) offset = -offset;		int scale = getOffScale() + 1;		return((double)offset * scale / 4);	}	/** Method to return the offset scale of the text in the text descriptor. */	private int getOffScale() { return getField(VTOFFSCALE, VTOFFSCALESH); }	/**	 * Method to return the Unit of the TextDescriptor.	 * Unit describes the type of real-world unit to apply to the value.	 * For example, if this value is in volts, the Unit tells whether the value	 * is volts, millivolts, microvolts, etc.	 * @return the Unit of the TextDescriptor.	 */	public Unit getUnit() { return Unit.getUnitAt(getField(VTUNITS, VTUNITSSH) & VTUNITSHMASK); }	/**	 * Method to return the color index of the TextDescriptor.	 * Color indices are more general than colors, because they can handle	 * transparent layers, C-Electric-style opaque layers, and full color values.	 * Methods in "EGraphics" manipulate color indices.	 * @return the color index of the TextDescriptor.	 */	public abstract int getColorIndex();}

⌨️ 快捷键说明

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