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

📄 vectorcache.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
	 * @param vc the cached cell in which to place the NodeInst.     */	private void drawNode(NodeInst ni, AffineTransform trans, VectorCell vc)	{		NodeProto np = ni.getProto();		AffineTransform localTrans = ni.rotateOut(trans);		// draw the node		if (ni.isCellInstance())		{			// cell instance: record a call to the instance			Point2D ctrShift = new Point2D.Double(ni.getAnchorCenterX(), ni.getAnchorCenterY());			localTrans.transform(ctrShift, ctrShift);			VectorSubCell vsc = new VectorSubCell(ni, ctrShift);			vc.subCells.add(vsc);            // show the ports that are not further exported or connected            for(Iterator<Connection> it = ni.getConnections(); it.hasNext();) {                Connection con = it.next();                PortInst pi = con.getPortInst();                Export e = (Export)pi.getPortProto();                if (!e.isAlwaysDrawn())                	vsc.shownPorts.set(e.getId().getChronIndex());            }            for(Iterator<Export> it = ni.getExports(); it.hasNext();) {                Export exp = it.next();                PortInst pi = exp.getOriginalPort();                Export e = (Export)pi.getPortProto();                if (!e.isAlwaysDrawn())                	vsc.shownPorts.set(e.getId().getChronIndex());            }			// draw any displayable variables on the instance			Poly[] polys = ni.getDisplayableVariables(dummyWnd);			drawPolys(polys, localTrans, vc, false, VectorText.TEXTTYPENODE, false);		} else		{			// primitive: save it			PrimitiveNode prim = (PrimitiveNode)np;			int textType = VectorText.TEXTTYPENODE;			if (prim == Generic.tech().invisiblePinNode) textType = VectorText.TEXTTYPEANNOTATION;			Technology tech = prim.getTechnology();            boolean hideOnLowLevel = ni.isVisInside() || np == Generic.tech().cellCenterNode;			boolean pureLayer = (ni.getFunction() == PrimitiveNode.Function.NODE);			drawPolys(tech.getShapeOfNode(ni, false, false, null), localTrans, vc, hideOnLowLevel, textType, pureLayer);			drawPolys(ni.getDisplayableVariables(dummyWnd), localTrans, vc, hideOnLowLevel, textType, pureLayer);		}	}	/**	 * Method to cache an ArcInst.	 * @param ai the ArcInst to cache.     * @param trans the transformation of the ArcInst to the parent cell.	 * @param vc the cached cell in which to place the ArcInst.     */	private void drawArc(ArcInst ai, AffineTransform trans, VectorCell vc)	{		// draw the arc		ArcProto ap = ai.getProto();		Technology tech = ap.getTechnology();		boolean pureLayer = (ap.getNumArcLayers() == 1);		drawPolys(tech.getShapeOfArc(ai), trans, vc, false, VectorText.TEXTTYPEARC, pureLayer);		drawPolys(ai.getDisplayableVariables(dummyWnd), trans, vc, false, VectorText.TEXTTYPEARC, false);	}	/**	 * Method to cache an array of polygons.	 * @param polys the array of polygons to cache.	 * @param trans the transformation to apply to each polygon.	 * @param vc the cached cell in which to place the polygons.	 * @param hideOnLowLevel true if the polygons should be marked such that they are not visible on lower levels of hierarchy.	 * @param pureLayer true if these polygons come from a pure layer node.	 */	private void drawPolys(Poly[] polys, AffineTransform trans, VectorCell vc, boolean hideOnLowLevel, int textType, boolean pureLayer)	{		if (polys == null) return;		for(int i = 0; i < polys.length; i++)		{			// get the polygon and transform it			Poly poly = polys[i];			if (poly == null) continue;			// transform the bounds			poly.transform(trans);			// render the polygon			renderPoly(poly, vc, hideOnLowLevel, textType, pureLayer);		}	}	/**	 * Method to cache a Poly.	 * @param poly the polygon to cache.	 * @param vc the cached cell in which to place the polygon.	 * @param hideOnLowLevel true if the polygon should be marked such that it is not visible on lower levels of hierarchy.	 * @param pureLayer true if the polygon comes from a pure layer node.	 */	private void renderPoly(Poly poly, VectorCell vc, boolean hideOnLowLevel, int textType, boolean pureLayer)	{		// now draw it		Point2D [] points = poly.getPoints();		Layer layer = poly.getLayer();		EGraphics graphics = null;		if (layer != null)			graphics = layer.getGraphics();		Poly.Type style = poly.getStyle();        ArrayList<VectorBase> filledShapes = hideOnLowLevel ? vc.topOnlyShapes : vc.filledShapes;        ArrayList<VectorBase> shapes = hideOnLowLevel ? vc.topOnlyShapes : vc.shapes;		if (style == Poly.Type.FILLED)		{			Rectangle2D bounds = poly.getBox();			if (bounds != null)			{				// convert coordinates				double lX = bounds.getMinX();				double hX = bounds.getMaxX();				double lY = bounds.getMinY();				double hY = bounds.getMaxY();                float minSize = (float)Math.min(hX - lX, hY - lY);                int layerIndex = -1;				if (layer != null)				{                    Technology tech = layer.getTechnology();                    if (tech != null && vc.vcg != null && tech.getTechName().equals(vc.vcg.cellBackup.cellRevision.d.techId.techName))                        layerIndex = layer.getIndex();				}                if (layerIndex >= 0) {                    putBox(layerIndex, pureLayer ? pureBoxBuilders : boxBuilders, lX, lY, hX, hY);                } else {                    VectorManhattan vm = new VectorManhattan(lX, lY, hX, hY, layer, graphics, pureLayer);                    filledShapes.add(vm);                }                // ignore implant layers when computing largest feature size				if (layer != null)				{					Layer.Function fun = layer.getFunction();					if (fun.isSubstrate()) minSize = 0;				}                vc.maxFeatureSize = Math.max(vc.maxFeatureSize, minSize);				return;			}			VectorPolygon vp = new VectorPolygon(points, layer, graphics);			filledShapes.add(vp);			return;		}		if (style == Poly.Type.CROSSED)		{			VectorLine vl1 = new VectorLine(points[0].getX(), points[0].getY(),				points[1].getX(), points[1].getY(), 0, layer, graphics);			VectorLine vl2 = new VectorLine(points[1].getX(), points[1].getY(),				points[2].getX(), points[2].getY(), 0, layer, graphics);			VectorLine vl3 = new VectorLine(points[2].getX(), points[2].getY(),				points[3].getX(), points[3].getY(), 0, layer, graphics);			VectorLine vl4 = new VectorLine(points[3].getX(), points[3].getY(),				points[0].getX(), points[0].getY(), 0, layer, graphics);			VectorLine vl5 = new VectorLine(points[0].getX(), points[0].getY(),				points[2].getX(), points[2].getY(), 0, layer, graphics);			VectorLine vl6 = new VectorLine(points[1].getX(), points[1].getY(),				points[3].getX(), points[3].getY(), 0, layer, graphics);			shapes.add(vl1);			shapes.add(vl2);			shapes.add(vl3);			shapes.add(vl4);			shapes.add(vl5);			shapes.add(vl6);			return;		}		if (style.isText())		{			Rectangle2D bounds = poly.getBounds2D();			TextDescriptor descript = poly.getTextDescriptor();			String str = poly.getString();			VectorText vt = new VectorText(bounds, style, descript, str, textType, null,				layer, graphics);			shapes.add(vt);			vc.maxFeatureSize = Math.max(vc.maxFeatureSize, vt.height);			return;		}		if (style == Poly.Type.CLOSED || style == Poly.Type.OPENED || style == Poly.Type.OPENEDT1 ||			style == Poly.Type.OPENEDT2 || style == Poly.Type.OPENEDT3)		{			int lineType = 0;			if (style == Poly.Type.OPENEDT1) lineType = 1; else			if (style == Poly.Type.OPENEDT2) lineType = 2; else			if (style == Poly.Type.OPENEDT3) lineType = 3;			for(int j=1; j<points.length; j++)			{				Point2D oldPt = points[j-1];				Point2D newPt = points[j];				VectorLine vl = new VectorLine(oldPt.getX(), oldPt.getY(),					newPt.getX(), newPt.getY(), lineType, layer, graphics);				shapes.add(vl);			}			if (style == Poly.Type.CLOSED)			{				Point2D oldPt = points[points.length-1];				Point2D newPt = points[0];				VectorLine vl = new VectorLine(oldPt.getX(), oldPt.getY(),					newPt.getX(), newPt.getY(), lineType, layer, graphics);				shapes.add(vl);			}			return;		}		if (style == Poly.Type.VECTORS)		{			for(int j=0; j<points.length; j+=2)			{				Point2D oldPt = points[j];				Point2D newPt = points[j+1];				VectorLine vl = new VectorLine(oldPt.getX(), oldPt.getY(),					newPt.getX(), newPt.getY(), 0, layer, graphics);				shapes.add(vl);			}			return;		}		if (style == Poly.Type.CIRCLE)		{			VectorCircle vci = new VectorCircle(points[0].getX(), points[0].getY(),				points[1].getX(), points[1].getY(), 0, layer, graphics);			shapes.add(vci);			return;		}		if (style == Poly.Type.THICKCIRCLE)		{			VectorCircle vci = new VectorCircle(points[0].getX(), points[0].getY(),				points[1].getX(), points[1].getY(), 1, layer, graphics);			shapes.add(vci);			return;		}		if (style == Poly.Type.DISC)		{			VectorCircle vci = new VectorCircle(points[0].getX(), points[0].getY(), points[1].getX(),				points[1].getY(), 2, layer, graphics);			filledShapes.add(vci);			return;		}		if (style == Poly.Type.CIRCLEARC || style == Poly.Type.THICKCIRCLEARC)		{			VectorCircleArc vca = new VectorCircleArc(points[0].getX(), points[0].getY(),				points[1].getX(), points[1].getY(), points[2].getX(), points[2].getY(),				style == Poly.Type.THICKCIRCLEARC, layer, graphics);			shapes.add(vca);			return;		}		if (style == Poly.Type.CROSS)		{			// draw the cross			VectorCross vcr = new VectorCross(points[0].getX(), points[0].getY(), true, layer, graphics);			shapes.add(vcr);			return;		}		if (style == Poly.Type.BIGCROSS)		{			// draw the big cross			VectorCross vcr = new VectorCross(points[0].getX(), points[0].getY(), false, layer, graphics);			shapes.add(vcr);			return;		}	}    private static void putBox(int layerIndex, ArrayList<VectorManhattanBuilder> boxBuilders, double lX, double lY, double hX, double hY) {        while (layerIndex >= boxBuilders.size()) boxBuilders.add(new VectorManhattanBuilder());        VectorManhattanBuilder b = boxBuilders.get(layerIndex);        b.add(lX, lY, hX, hY);    }//    /*------------------------------------------------------*/////    public void showStatistics(Layer layer) {//        Map<Layer,GenMath.MutableInteger> totalLayerBag = new TreeMap<Layer,GenMath.MutableInteger>(Layer.layerSortByName);//        int numCells = 0, numCellLayer = 0;//        int totalNoBox = 0, totalNoPoly = 0, totalNoDisc = 0, totalNoShapes = 0, totalNoText = 0, totalNoTopShapes = 0, totalNoTopText = 0;//        for (VectorCellGroup vcg: cachedCells) {//            if (vcg == null) continue;//            VectorCell vc = vcg.getAnyCell();//            numCells++;//            Map<Layer,GenMath.MutableInteger> layerBag = new TreeMap<Layer,GenMath.MutableInteger>(Layer.layerSortByName);//            int noText = 0, noTopText = 0;//            for (VectorBase vs: vc.filledShapes) {//                if (vs instanceof VectorManhattan)//                    totalNoBox++;//                else if (vs instanceof VectorPolygon)//                    totalNoPoly++;//                else if (vs instanceof VectorCircle)//                    totalNoDisc++;//                assert vs.layer != null;//                GenMath.addToBag(layerBag, vs.layer);//            }//            numCellLayer += layerBag.size();//            GenMath.addToBag(totalLayerBag, layerBag);//            for (VectorBase vs: vc.shapes) {//                if (vs instanceof VectorText)//                    noText++;//            }//            totalNoShapes += vc.shapes.size();//            totalNoText += noText;//            for (VectorBase vs: vc.topOnlyShapes) {//                if (vs instanceof VectorText)//                    noTopText++;//            }//            totalNoTopShapes += vc.topOnlyShapes.size();//            totalNoTopText += noTopText;//            System.out.print(vcg.cellBackup.d.cellName + " " + vcg.orientations.size() + " ors " + vc.subCells.size() + " subs " +//                    vc.topOnlyShapes.size() + " topOnlyShapes(" + noTopText + " text) " +//                    vc.shapes.size() + " shapes(" + noText + " text) " +//                    vc.filledShapes.size() + " filledShapes ");//            for (Map.Entry<Layer,GenMath.MutableInteger> e: layerBag.entrySet())//                System.out.print(" " + e.getKey().getName() + ":" + e.getValue());//            System.out.println();//        }//        System.out.println(numCells + " cells " + numCellLayer + " cellLayes");//        System.out.println("Top shapes " + totalNoTopShapes + " (" + totalNoTopText + " text)");//        System.out.println("Shapes " + totalNoShapes + " (" + totalNoText + " text)");//        System.out.print("FilledShapes " + (totalNoBox + totalNoPoly + totalNoDisc) + " (" +//                totalNoBox + " boxes " + totalNoPoly + " polys " + totalNoDisc + " discs  ");//        for (Map.Entry<Layer,GenMath.MutableInteger> e: totalLayerBag.entrySet())//            System.out.print(" " + e.getKey().getName() + ":" + e.getValue());//        System.out.println();////        EditWindow wnd = (EditWindow)Job.getUserInterface().needCurrentEditWindow_();//        VectorCellGroup topCell = cachedCells.get(wnd.getCell().getCellIndex());//        HashMap<VectorCell,LayerDrawing.LayerCell> layerCells = new HashMap<VectorCell,LayerDrawing.LayerCell>();//        LayerDrawing ld = new LayerDrawing(layer);//        ld.topCell = gatherLayer(topCell, Orientation.IDENT, layer, ld, layerCells);//        System.out.println(layerCells.size() + " layerCells");//        ld.draw(wnd);//    }////    private LayerDrawing.LayerCell gatherLayer(VectorCellGroup vcg, Orientation or, Layer layer, LayerDrawing ld, HashMap<VectorCell,LayerDrawing.LayerCell> layerCells) {//        VectorCell vc = vcg.orientations.get(or.canonic());//        if (vc == null || !vc.valid) return null;//        LayerDrawing.LayerCell lc = layerCells.get(vc);//        if (lc == null) {//            lc = ld.newCell();//            layerCells.put(vc, lc);//            for (VectorBase vs: vc.filledShapes) {//                if (vs.layer == layer && vs instanceof VectorManhattan) {//                    VectorManhattan vm = (VectorManhattan)vs;//                    for (int i = 0; i < vm.coords.length; i += 4) {//                        int c1X = vm.coords[i];//                        int c1Y = vm.coords[i + 1];//                        int c2X = vm.coords[i + 2];//                        int c2Y = vm.coords[i + 3];//                        lc.rects.add(new Rectangle2D.Float(c1X, c1Y, c2X - c1X, c2Y - c1Y));//                    }//                }//            }//            for (VectorSubCell vsc: vc.subCells) {//                VectorCellGroup subVC = cachedCells.get(vsc.subCell.getCellIndex());//                if (subVC == null) continue;//				Orientation recurseTrans = or.concatenate(vsc.pureRotate);//                LayerDrawing.LayerCell proto = gatherLayer(subVC, recurseTrans, layer, ld, layerCells);//                if (proto == null) continue;//                lc.addSubCell(proto, vsc.offsetX, vsc.offsetY);//            }//        }//        return lc;//    }}

⌨️ 快捷键说明

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