Exemplo n.º 1
0
  /**
   * Identifies.
   *
   * @param reader the catalog reader.
   * @exception IOException if the catalog cannot be accessed.
   * @exception QueryFailException if the query to the server is failed.
   */
  public void identify(CatalogReader reader) throws IOException, QueryFailException {
    // Starts the polling thread.
    PollingThread thread = new PollingThread();
    thread.start();

    try {
      Variability[] records = getSelectedRecords();

      for (int i = 0; i < records.length; i++) {
        CatalogStar star = records[i].getStar();

        StarList l = reader.read(star.getCoor(), 0.1);
        for (int j = 0; j < l.size(); j++) {
          CatalogStar s = (CatalogStar) l.elementAt(j);

          double radius =
              star.getMaximumPositionErrorInArcsec() + s.getMaximumPositionErrorInArcsec();
          double distance = star.getCoor().getAngularDistanceTo(s.getCoor());

          if (distance < radius / 3600.0)
            // Overwrites the already identified star.
            records[i].setIdentifiedStar(s);
        }
      }
    } finally {
      // Ends the polling thread.
      thread.end();
    }
  }