Example #1
0
  /** Method to parse the arc cell in "np" and return an ArcInfo object that describes it. */
  static ArcInfo parseCell(Cell np) {
    // create and initialize the GRAPHICS structure
    ArcInfo aIn = new ArcInfo();
    aIn.name = np.getName().substring(4);

    // look at all nodes in the arc description cell
    for (Iterator<NodeInst> it = np.getNodes(); it.hasNext(); ) {
      NodeInst ni = it.next();
      Variable var = ni.getVar(OPTION_KEY);
      if (var == null) continue;
      String str = getValueOnNode(ni);

      switch (((Integer) var.getObject()).intValue()) {
        case ARCFUNCTION:
          aIn.func = ArcProto.Function.UNKNOWN;
          List<ArcProto.Function> allFuncs = ArcProto.Function.getFunctions();
          for (ArcProto.Function fun : allFuncs) {
            if (fun.toString().equalsIgnoreCase(str)) {
              aIn.func = fun;
              break;
            }
          }
          break;
        case ARCINC:
          aIn.angInc = TextUtils.atoi(str);
          break;
        case ARCFIXANG:
          aIn.fixAng = str.equalsIgnoreCase("yes");
          break;
        case ARCWIPESPINS:
          aIn.wipes = str.equalsIgnoreCase("yes");
          break;
        case ARCNOEXTEND:
          aIn.noExtend = str.equalsIgnoreCase("no");
          break;
        case ARCANTENNARATIO:
          aIn.antennaRatio = TextUtils.atof(str);
          break;
        case ARCWIDTHOFFSET:
          aIn.widthOffset = TextUtils.atof(str);
          break;
      }
    }
    return aIn;
  }
Example #2
0
 /**
  * Method to get the transparent color information from a NodeInst.
  *
  * @param ni the NodeInst to examine.
  * @return an array of Color values. Returns null if no such data exists on the NodeInst.
  */
 public static Color[] getTransparentColors(NodeInst ni) {
   int opt = Manipulate.getOptionOnNode(ni);
   if (opt != TECHTRANSPCOLORS) return null;
   Variable var = ni.getVar(TRANSLAYER_KEY);
   String transparentColorsStr = (String) var.getObject();
   int colon = transparentColorsStr.indexOf(':');
   if (colon >= 0) transparentColorsStr = transparentColorsStr.substring(colon + 1);
   if (var == null) return null;
   Color[] colors = TextUtils.getTransparentColors(transparentColorsStr);
   return colors;
 }
Example #3
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);
        }
      }
    }
  }