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

📄 nodeinst.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		try		{			return parent != null && parent.isLinked() && parent.getNode(nodeIndex) == this;		} catch (IndexOutOfBoundsException e)		{			return false;		}	}	/****************************** GRAPHICS ******************************/    /**     * Method to return the Orientation of this NodeInst.     * @return the Orientation of this NodeInst.     */    public Orientation getOrient() { return d.orient; }	/**	 * Method to return the rotation angle of this NodeInst.	 * @return the rotation angle of this NodeInst (in tenth-degrees).	 */	public int getAngle() { return d.orient.getAngle(); }	/**	 * Method to return the center point of this NodeInst object.	 * @return the center point of this NodeInst object.	 */	public EPoint getAnchorCenter() { return d.anchor; }	/**	 * Method to return the center X coordinate of this NodeInst.	 * @return the center X coordinate of this NodeInst.	 */	public double getAnchorCenterX() { return d.anchor.getX(); }	/**	 * Method to return the center Y coordinate of this NodeInst.	 * @return the center Y coordinate of this NodeInst.	 */	public double getAnchorCenterY() { return d.anchor.getY(); }	/**	 * Method to return the X size of this NodeInst.	 * @return the X size of this NodeInst.	 */	public double getXSize() {        if (protoType instanceof Cell)            return protoType.getDefWidth();        long fullWidth = ((PrimitiveNode)protoType).getFullRectangle().getGridWidth();        return DBMath.gridToLambda(d.size.getGridX() + fullWidth);    }	/**	 * Method to return the base X size of this NodeInst in lambda units.	 * @return the base X size of this NodeInst.	 */	public double getLambdaBaseXSize() {        if (protoType instanceof Cell) return protoType.getDefWidth();        return DBMath.gridToLambda(d.size.getGridX() + getBaseRectangle().getGridWidth());    }    /**	 * Method similar to getXSize() to return the X size of this NodeInst without the offset.	 * @return the X size of this NodeInst.	 */	public double getXSizeWithoutOffset()    {        return GenMath.isNinetyDegreeRotation(getAngle()) ? getLambdaBaseYSize() : getLambdaBaseXSize();    }	/**	 * Method to return the Y size of this NodeInst.	 * @return the Y size of this NodeInst.	 */	public double getYSize() {        if (protoType instanceof Cell)            return protoType.getDefHeight();        long fullHeight = ((PrimitiveNode)protoType).getFullRectangle().getGridHeight();        return DBMath.gridToLambda(d.size.getGridY() + fullHeight);    }	/**	 * Method to return the base Y size of this NodeInst in lambda units.	 * @return the base Y size of this NodeInst.	 */	public double getLambdaBaseYSize() {        if (protoType instanceof Cell) return protoType.getDefHeight();        return DBMath.gridToLambda(d.size.getGridY() + getBaseRectangle().getGridHeight());    }    /**	 * Method similar to getXSize() to return the X size of this NodeInst without the offset.	 * @return the X size of this NodeInst.	 */	public double getYSizeWithoutOffset()    {        return GenMath.isNinetyDegreeRotation(getAngle()) ? getLambdaBaseXSize() : getLambdaBaseYSize();    }	/**	 * Method to return whether NodeInst is mirrored about a	 * horizontal line running through its center.	 * @return true if mirrored.	 */	public boolean isMirroredAboutXAxis() { return isYMirrored(); }	/**	 * Method to return whether NodeInst is mirrored about a	 * vertical line running through its center.	 * @return true if mirrored.	 */	public boolean isMirroredAboutYAxis() { return isXMirrored(); }	/**	 * Method to tell whether this NodeInst is mirrored in the X coordinate.	 * Mirroring in the X axis implies that X coordinates are negated.	 * Thus, it is equivalent to mirroring ABOUT the Y axis.	 * @return true if this NodeInst is mirrored in the X coordinate.	 */	public boolean isXMirrored() { return d.orient.isXMirrored(); }	/**	 * Method to tell whether this NodeInst is mirrored in the Y coordinate.	 * Mirroring in the Y axis implies that Y coordinates are negated.	 * Thus, it is equivalent to mirroring ABOUT the X axis.	 * @return true if this NodeInst is mirrored in the Y coordinate.	 */	public boolean isYMirrored() { return d.orient.isYMirrored(); }    /**     * Returns the polygons that describe this NodeInst.     * @param polyBuilder Poly builder.     * @return an iterator on Poly objects that describes this NodeInst graphically.     * These objects include displayable variables on the NodeInst.     */    @Override    public Iterator<Poly> getShape(Poly.Builder polyBuilder) { return polyBuilder.getShape(this); }    /**     * Returns the polygon that describe the base highlight of this NodeInst.     * @return a  Poly object that describes the highlight of this NodeInst graphically.     */    public Poly getBaseShape() {        return getBaseShape(d.anchor, d.size);    }    /**     * Returns the polygon that describe the base highlight of this NodeInst with modified size.     * @param baseWidth modified base width in lambda units     * @param baseHeight modified base height in lambda units     * @return a  Poly object that describes the highlight of this NodeInst graphically.     */    public Poly getBaseShape(EPoint anchor, double baseWidth, double baseHeight) {        EPoint newSize = EPoint.ORIGIN;        if (protoType instanceof PrimitiveNode) {            ERectangle base = getBaseRectangle();            newSize = EPoint.fromLambda(baseWidth - base.getWidth(), baseHeight - base.getHeight());        }        return getBaseShape(anchor, newSize);    }    /**     * Returns the polygon that describe the base highlight of this NodeInst with modified size.     * @param size modified size     * @return a  Poly object that describes the highlight of this NodeInst graphically.     */    private Poly getBaseShape(EPoint anchor, EPoint size) {        double nodeLowX;        double nodeHighX;        double nodeLowY;        double nodeHighY;        if (protoType instanceof Cell) {            ERectangle r = ((Cell)protoType).getBounds();            nodeLowX = r.getLambdaMinX();            nodeHighX = r.getLambdaMaxX();            nodeLowY = r.getLambdaMinY();            nodeHighY = r.getLambdaMaxY();        } else {            ERectangle baseRect = getBaseRectangle();            long halfW = size.getGridX() >> 1;            long halfH = size.getGridY() >> 1;            nodeLowX = DBMath.gridToLambda(-halfW + baseRect.getGridMinX());            nodeHighX = DBMath.gridToLambda(halfW + baseRect.getGridMaxX());            nodeLowY = DBMath.gridToLambda(-halfH + baseRect.getGridMinY());            nodeHighY = DBMath.gridToLambda(halfH + baseRect.getGridMaxY());        }        Point2D[] points;        if (nodeLowX != nodeHighX || nodeLowY != nodeHighY)            points = Poly.makePoints(nodeLowX, nodeHighX, nodeLowY, nodeHighY);        else            points = new Point2D[] { new Point2D.Double(nodeLowX, nodeLowY) };        Poly poly = new Poly(points);        AffineTransform trans = getOrient().rotateAbout(anchor.getLambdaX(), anchor.getLambdaY(), 0, 0);        poly.transform(trans);        return poly;    }    /**	 * Method to return the bounds of this NodeInst.	 * TODO: dangerous to give a pointer to our internal field; should make a copy of visBounds	 * @return the bounds of this NodeInst.	 */    @Override    public Rectangle2D getBounds() {        if (validVisBounds)            return visBounds;        EDatabase database = getDatabase();        if (database != null && !database.canComputeBounds())            return visBounds;        computeBounds();        validVisBounds = true;        return visBounds;    }    private void computeBounds() {        double oldX = visBounds.x;        double oldY = visBounds.y;        double oldWidth = visBounds.width;        double oldHeight = visBounds.height;        d.computeBounds(this, visBounds);        if ((oldX != visBounds.x || oldY != visBounds.y || oldWidth != visBounds.width || oldHeight != visBounds.height) &&                parent != null) {            parent.setDirty();        }    }    /**     * Method to recalculate the Geometric bounds for this NodeInst.     */    public void redoGeometric() {        if (parent != null)            parent.setGeomDirty();        validVisBounds = false;    }	/**	 * Method to return the starting and ending angle of an arc described by this NodeInst.	 * These values can be found in the "ART_degrees" variable on the NodeInst.	 * @return a 2-long double array with the starting offset in the first entry (a value in radians)	 * and the amount of curvature in the second entry (in radians).	 * If the NodeInst does not have circular information, both values are set to zero.	 */	public double [] getArcDegrees()	{		double [] returnValues = new double[2];		returnValues[0] = returnValues[1] = 0.0;		if (!(protoType instanceof PrimitiveNode)) return returnValues;		if (protoType != Artwork.tech().circleNode && protoType != Artwork.tech().thickCircleNode) return returnValues;		Variable var = getVar(Artwork.ART_DEGREES);		if (var != null)		{			Object addr = var.getObject();			if (addr instanceof Integer)			{				Integer iAddr = (Integer)addr;				returnValues[0] = 0.0;				returnValues[1] = iAddr.intValue() * Math.PI / 1800.0;			} else if (addr instanceof Float[])			{				Float [] fAddr = (Float [])addr;				returnValues[0] = fAddr[0].doubleValue();				returnValues[1] = fAddr[1].doubleValue();			}		}		return returnValues;	}	/**	 * Method to set the starting and ending angle of an arc described by this NodeInst.	 * These values are stored in the "ART_degrees" variable on the NodeInst.	 * @param start the starting offset of the angle (typically 0)	 * @param curvature the the amount of curvature	 */	public void setArcDegrees(double start, double curvature)	{		if (!(protoType instanceof PrimitiveNode)) return;		if (protoType != Artwork.tech().circleNode && protoType != Artwork.tech().thickCircleNode) return;		if (start == 0 && curvature == 0)		{			if (getVar(Artwork.ART_DEGREES) == null) return;			delVar(Artwork.ART_DEGREES);		} else		{			Float [] fAddr = new Float[2];			fAddr[0] = new Float(start);			fAddr[1] = new Float(curvature);			newVar(Artwork.ART_DEGREES, fAddr);		}	}	/**	 * Method to get the base (highlight) ERectangle associated with a NodeInst     * in this PrimitiveNode.     * Base ERectangle is a highlight rectangle of standard-size NodeInst of     * this PrimtiveNode	 * By having this be a method of Technology, it can be overridden by	 * individual Technologies that need to make special considerations.	 * @param ni the NodeInst to query.	 * @return the base ERectangle of this PrimitiveNode.	 */    private ERectangle getBaseRectangle() {        return ((PrimitiveNode)protoType).getBaseRectangle();//        return ((PrimitiveNode)protoType).getTechnology().getNodeInstBaseRectangle(this);    }//	/**//	 * Method to return a list of Polys that describes all text on this NodeInst.//	 * @param hardToSelect is true if considering hard-to-select text.//	 * @param wnd the window in which the text will be drawn.//	 * @return an array of Polys that describes the text.//	 *///	public Poly [] getAllText(boolean hardToSelect, EditWindow0 wnd)//	{//		int cellInstanceNameText = 0;//		if (protoType instanceof Cell && !isExpanded() && hardToSelect) cellInstanceNameText = 1;//		if (!User.isTextVisibilityOnInstance()) cellInstanceNameText = 0;//		int dispVars = numDisplayableVariables(false);//		int numExports = 0;//		int numExportVariables = 0;//		if (User.isTextVisibilityOnExport())//		{//			numExports = getNumExports();//			for(Iterator<Export> it = getExports(); it.hasNext(); )//			{//				Export pp = it.next();//				numExportVariables += pp.numDisplayableVariables(false);//			}//		}//		if (protoType == Generic.tech.invisiblePinNode &&//			!User.isTextVisibilityOnAnnotation())//		{//			dispVars = numExports = numExportVariables = 0;//		}//		if (!User.isTextVisibilityOnNode())//		{//			cellInstanceNameText = dispVars = numExports = numExportVariables = 0;//		}//		int totalText = cellInstanceNameText + dispVars + numExports + numExportVariables;//		if (totalText == 0) return null;//		Poly [] polys = new Poly[totalText];//		int start = 0;////		// add in the cell name if appropriate//		if (cellInstanceNameText != 0)//		{//			double cX = getTrueCenterX();//			double cY = getTrueCenterY();//			TextDescriptor td = getTextDescriptor(NodeInst.NODE_PROTO);

⌨️ 快捷键说明

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