Esempio n. 1
0
  /** 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);
        }
      }
    }
  }
Esempio n. 2
0
 void makeDrawns() {
   Arrays.fill(drawns, -1);
   numDrawns = 0;
   for (int i = 0; i < numExports; i++) {
     if (drawns[i] >= 0) {
       continue;
     }
     drawns[i] = numDrawns;
     ImmutableExport export = exports.get(i);
     addToDrawn(new PortInst(export));
     numDrawns++;
   }
   numExportedDrawns = numDrawns;
   for (int i = 0; i < numArcs; i++) {
     if (drawns[arcsOffset + i] >= 0) {
       continue;
     }
     ImmutableArcInst a = arcs.get(i);
     ArcProto ap = techPool.getArcProto(a.protoId);
     if (ap.getFunction() == ArcProto.Function.NONELEC) {
       continue;
     }
     drawns[arcsOffset + i] = numDrawns;
     if (DEBUG) {
       System.out.println(numDrawns + ": " + a.name);
     }
     PortInst hpi = new PortInst(a, ImmutableArcInst.HEADEND);
     if (hpi.portId != busPinPortId || ap == busArc) {
       addToDrawn(hpi);
     }
     PortInst tpi = new PortInst(a, ImmutableArcInst.TAILEND);
     if (tpi.portId != busPinPortId || ap == busArc) {
       addToDrawn(tpi);
     }
     numDrawns++;
   }
   numConnectedDrawns = numDrawns;
   for (int i = 0; i < numNodes; i++) {
     ImmutableNodeInst n = nodes.get(i);
     if (n.protoId instanceof CellId) {
       if (isIconOfParent(n)) {
         continue;
       }
     } else {
       PrimitiveNode pn = techPool.getPrimitiveNode((PrimitiveNodeId) n.protoId);
       if (pn.getFunction() == PrimitiveNode.Function.ART && pn != Generic.tech().simProbeNode
           || pn == Artwork.tech().pinNode
           || pn == Generic.tech().invisiblePinNode) {
         continue;
       }
     }
     //            NodeProto np = ni.getProto();
     int numPortInsts = getNumPorts(n.protoId);
     for (int j = 0; j < numPortInsts; j++) {
       PortInst pi = new PortInst(n.nodeId, getPortIdByIndex(n.protoId, j));
       int piOffset = pi.getPortInstOffset();
       if (drawns[piOffset] >= 0) {
         continue;
       }
       if (n.protoId instanceof PrimitiveNodeId
           && techPool.getPrimitivePort((PrimitivePortId) pi.portId).isIsolated()) {
         continue;
       }
       addToDrawn(pi);
       numDrawns++;
     }
   }
 }