/** Method to compact an Arc technology-edit cell */ static void compactCell(Cell cell) { // compute bounds of arc contents Rectangle2D nonSpecBounds = null; for (Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); if (ni.getProto() == Generic.tech().cellCenterNode) continue; // ignore the special text nodes boolean special = false; for (int i = 0; i < arcTextTable.length; i++) if (arcTextTable[i].ni == ni) special = true; if (special) continue; // compute overall bounds Rectangle2D bounds = ni.getBounds(); if (nonSpecBounds == null) nonSpecBounds = bounds; else Rectangle2D.union(nonSpecBounds, bounds, nonSpecBounds); } // now rearrange the geometry if (nonSpecBounds != null) { double xOff = -nonSpecBounds.getCenterX(); double yOff = -nonSpecBounds.getMaxY(); if (xOff != 0 || yOff != 0) { for (Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); if (ni.getProto() == Generic.tech().cellCenterNode) continue; // ignore the special text nodes boolean special = false; for (int i = 0; i < arcTextTable.length; i++) if (arcTextTable[i].ni == ni) special = true; if (special) continue; // center the geometry ni.move(xOff, yOff); } } } }