コード例 #1
0
ファイル: CDSXMatch.java プロジェクト: jankotek/asterope
  private Legende createLeg(
      int xmatchType, boolean ellXMatch, Source s1, Source s2, int[] coordTab1) {
    Vector<Field> v = new Vector<Field>();

    // ajout du champ distance (sauf en cas de JOIN)
    if (xmatchType != JOIN) {
      Field distField = ellXMatch ? new Field("NSigma") : new Field("dist");
      distField.ucd = ellXMatch ? UCD_SIGMA : UCD_DIST;
      distField.datatype = "D";
      distField.description =
          ellXMatch ? "Distance in sigmas" : "Distance between 2 cross-matched sources";
      distField.unit = ellXMatch ? "---" : "arcsec";
      distField.width = "7";
      distField.computeColumnSize();

      v.addElement(distField);
    }

    Source o = s1;
    String prefix, suffix;
    prefix = colFilter == null ? DEFAULT_PREFIX_T1 : colFilter.prefix1;
    suffix = colFilter == null ? DEFAULT_SUFFIX_T1 : colFilter.suffix1;
    addField(true, o, v, prefix, suffix, coordTab1, true);
    o = s2;
    prefix = colFilter == null ? DEFAULT_PREFIX_T2 : colFilter.prefix2;
    suffix = colFilter == null ? DEFAULT_SUFFIX_T2 : colFilter.suffix2;
    if (o != null) addField(false, o, v, prefix, suffix, null, false);
    Legende leg = new Legende(v);

    ucdRewriting(leg);

    return leg;
  }
コード例 #2
0
ファイル: CDSXMatch.java プロジェクト: jankotek/asterope
  /** ajout des champs de la source s */
  private void addField(
      boolean tab1,
      Source s,
      Vector<Field> v,
      String prefix,
      String suffix,
      int[] coordTab,
      boolean coo) {
    if (tab1) idxColToKeep1 = null;
    else idxColToKeep2 = null;

    if (colFilter != null) {
      if (tab1) idxColToKeep1 = new int[colFilter.fieldTab1.length];
      else idxColToKeep2 = new int[colFilter.fieldTab2.length];
    }

    Field f, curF;
    int k = 0;
    for (int i = 0; i < s.leg.field.length; i++) {
      curF = s.leg.field[i];

      // doit on conserver le field courant ?
      boolean keep = true;
      if (colFilter != null) {
        if (tab1) keep = colFilter.inTab1(curF.name);
        else keep = colFilter.inTab2(curF.name);

        if (keep) {
          if (tab1) idxColToKeep1[k++] = i;
          else idxColToKeep2[k++] = i;
        }
      }
      if (!keep) continue;

      f = new Field("");
      f.ID = curF.ID;
      f.name = prefix + curF.name + suffix;
      f.description = curF.description;
      f.title = prefix + curF.title + suffix;
      f.type = curF.type;
      f.unit = curF.unit;
      if (colFilter != null)
        f.ucd = tab1 ? colFilter.getUcdTab1(curF.name) : colFilter.getUcdTab2(curF.name);
      else f.ucd = curF.ucd;
      f.datatype = curF.datatype;
      f.width = curF.width;
      f.arraysize = curF.arraysize;
      f.columnSize = curF.columnSize;
      f.precision = curF.precision;
      f.href = curF.href;
      f.gref = curF.gref;
      f.refText = curF.refText;
      f.refValue = curF.refValue;
      //           if( coo && coordTab!=null && (i==coordTab[0] || i==coordTab[1]) ) f.coo = true;
      if (coo && coordTab != null && i == coordTab[0]) f.coo = Field.RA;
      if (coo && coordTab != null && i == coordTab[1]) f.coo = Field.DE;
      v.addElement(f);
    } // end of loop on different fields
  }