Exemplo n.º 1
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;
 }
Exemplo n.º 2
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;
  }