コード例 #1
0
ファイル: ArcInfo.java プロジェクト: imr/Electric8
  /** 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;
  }