Esempio n. 1
0
  /**
   * Create an AtmosModel object using a PVL specification.
   * An example of the PVL required for this is:
   *
   * @code
   * Object = AtmosphericModel
   *   Group = Algorithm
   *     # Use 'AtmName' instead of 'Name' if using the Gui combo box
   *     # for unique Pvl keyword in DefFile
   *     AtmName/Name = Isotropic1
   *     Tau = 0.7
   *     Tauref = 0.0
   *     Wha = 0.5
   *     Hnorm = 0.003
   *     Nulneg = NO
   *   EndGroup
   * EndObject
   * @endcode
   *
   * There are many other options that can be set via the pvl and are
   * described in other documentation (see below).
   *
   * @param pvl The pvl object containing the specification
   * @param pmodel The PhotoModel objects contining the data
   *
   * @return A pointer to the new AtmosModel
   *
   * @see atmosphericModels.doc
   **/
  AtmosModel *AtmosModelFactory::Create(Pvl &pvl, PhotoModel &pmodel) {

    // Get the algorithm name to create
    PvlGroup &algo = pvl.findObject("AtmosphericModel")
                     .findGroup("Algorithm", Pvl::Traverse);

    QString algorithm = "";
    if(algo.hasKeyword("AtmName")) {
      algorithm = QString(algo["AtmName"]);
    }
    else if(algo.hasKeyword("Name")) {
      algorithm = QString(algo["Name"]);
    }
    else {
      QString msg = "Keyword [Name] or keyword [AtmName] must ";
      msg += "exist in [Group = Algorithm]";
      throw IException(IException::User, msg, _FILEINFO_);
    }

    // Open the factory plugin file
    Plugin *p = new Plugin;
    FileName f("AtmosModel.plugin");
    if(f.fileExists()) {
      p->read("AtmosModel.plugin");
    }
    else {
      p->read("$ISISROOT/lib/AtmosModel.plugin");
    }

    // Get the algorithm specific plugin and return it
    AtmosModel * (*plugin)(Pvl & pvl, PhotoModel & pmodel);
    plugin = (AtmosModel * ( *)(Pvl & pvl, PhotoModel & pmodel))
             p->GetPlugin(algorithm);
    return (*plugin)(pvl, pmodel);
  }
Esempio n. 2
0
  /** 
   * Create an InterestOperator object using a PVL specification.
   * An example of the PVL required for this is:
   * 
   * @code
   * Object = InterestOperator
   *   Group = Operator
   *     Name      = StandardDeviation
   *     Samples   = 21
   *     Lines     = 21
   *     Delta     = 50
   *   EndGroup
   * EndObject
   * @endcode
   * 
   * There are many other options that can be set via the pvl and are
   * described in other documentation (see below).
   * 
   * @param pvl The pvl object containing the specification
   * 
   * @see automaticRegistration.doc
   **/
  InterestOperator *InterestOperatorFactory::Create(Pvl &pvl) {
    // Get the algorithm name to create
    PvlGroup &op = pvl.FindGroup("Operator",Pvl::Traverse);
    std::string operatorName = op["Name"];

    // Open the factory plugin file
    Plugin p;
    Filename f("InterestOperator.plugin");
    if (f.Exists()) {
      p.Read("InterestOperator.plugin");
    }
    else {
      p.Read("$ISISROOT/lib/InterestOperator.plugin");
    }

    // Get the algorithm specific plugin and return it
    InterestOperator * (*plugin) (Pvl &pvl);
    plugin = (InterestOperator * (*)(Pvl &pvl)) p.GetPlugin(operatorName);
    return (*plugin)(pvl);
  }