Unverified Commit ce746e08 authored by dcookastro's avatar dcookastro Committed by GitHub
Browse files

Merge branch 'devRadii' into devRadii

parents 42b8ace5 86e0bd6f
Loading
Loading
Loading
Loading
+5 −36
Original line number Diff line number Diff line
@@ -1736,12 +1736,6 @@ namespace Isis {
   *              group or NaifKeywords object).
   */
  void ControlNet::SetTarget(Pvl label) {
    QScopedPointer <QMutexLocker> locker;

    if (m_mutex) {
      locker.reset(new QMutexLocker(m_mutex));
    }

    PvlGroup mapping;
    if ( (label.hasObject("IsisCube") && label.findObject("IsisCube").hasGroup("Mapping"))
         || label.hasGroup("Mapping") ) {
@@ -1751,42 +1745,17 @@ namespace Isis {
    if (mapping.hasKeyword("TargetName")) {
      p_targetName = mapping["TargetName"][0];
    }
    else if (label.hasObject("IsisCube")
             && label.findObject("IsisCube").hasGroup("Instrument")
             && label.findObject("IsisCube").findGroup("Instrument").hasKeyword("TargetName")) {
      p_targetName = label.findObject("IsisCube").findGroup("Instrument").findKeyword("TargetName")[0];
    }
    else {
      p_targetName = "";
    }
  }


  /**
   * Directly sets the target name and radii using the given information.
   *
   * @see Target::radiiGroup(Pvl, PvlGroup)
   *
   * @param target The name of the target for this Control Network
   * @param target A 3-dimensional vector containing the A (equatorial major), B
   *               (equatorial minor), and C (polar) triaxial radii values of
   *               the target for this Control Network
   *
   */
  void ControlNet::SetTarget(const QString &target,
                             const QVector<Distance> &radii) {
    QScopedPointer <QMutexLocker> locker;

    if (m_mutex) {
      locker.reset(new QMutexLocker(m_mutex));
    }

    if (radii.size() != 3) {
      throw IException(IException::Unknown,
                       "Unable to set target radii. The given list must have length 3.",
                       _FILEINFO_);
    }

    p_targetName = target;

  }


  /**
   * Set the user name of the control network.
   *
+0 −2
Original line number Diff line number Diff line
@@ -311,8 +311,6 @@ namespace Isis {
      void SetTarget(const QString &target);
      void SetTarget(Pvl label);
      void SetTarget(const ControlNet &other);
      void SetTarget(const QString &target,
                     const QVector<Distance> &radii);
      void SetUserName(const QString &name);

      void swap(ControlNet &other);
+3 −20
Original line number Diff line number Diff line
@@ -83,28 +83,11 @@ testing GetCubeSerials... (NOTE: unittest sorts the results)
  DELTA

testing set target.................................
Set target/radii directly. Invalid radii.
**ERROR** Unable to set target radii. The given list must have length 3.

Set target/radii directly. Valid radii.
        TargetName = SomethingStrange

Set target/radii using empty PVL.
Set target using empty PVL.
        TargetName = 

Set target/radii using PVL with no PolarRadius.
Group = Mapping
  TargetName       = Mars
  EquatorialRadius = Null
End_Group
End
        TargetName = Mars

Set target/radii using PVL containing both radii.
Set target using actual PVL.
Group = Mapping
  TargetName = Mars
  EquatorialRadius = 6.0
  PolarRadius      = 1.0
End_Group
End
        TargetName = Mars
+2 −26
Original line number Diff line number Diff line
@@ -294,41 +294,17 @@ int main() {

  cout << "testing set target.................................\n";

  cout << "Set target/radii directly. Invalid radii." << endl;
  QVector<Distance> targetRadii;
  try {
    cn1.SetTarget("Fail", targetRadii);
  }
  catch (IException &e) {
    e.print();
  }
  cout << endl;
  cout << "Set target/radii directly. Valid radii." << endl;
  targetRadii += Distance(Isis::PI, Distance::Meters);
  targetRadii += Distance(Isis::HALFPI, Distance::Meters);
  targetRadii += Distance(Isis::E, Distance::Meters);
  cn1.SetTarget("SomethingStrange", targetRadii);
  cout << "        TargetName = " << cn1.GetTarget() << endl;
  cout << endl;
  cout << "Set target/radii using empty PVL." << endl;
  cout << "Set target using empty PVL." << endl;
  Pvl label;
  // no mapping group, (i.e. target name empty, no equatorial radius)
  // catch exception and set radii to nulls
  cn1.SetTarget(label);
  cout << "        TargetName = " << cn1.GetTarget() << endl;
  cout << endl;
  cout << "Set target/radii using PVL with no PolarRadius." << endl;
  cout << "Set target using actual PVL." << endl;
  label += PvlGroup("Mapping");
  PvlGroup &mapping = label.findGroup("Mapping");
  mapping += PvlKeyword("TargetName", "Mars");
  mapping += PvlKeyword("EquatorialRadius", "");
  cout << label << endl;
  cn1.SetTarget(label);
  cout << "        TargetName = " << cn1.GetTarget() << endl;
  cout << endl;
  cout << "Set target/radii using PVL containing both radii." << endl;
  mapping.addKeyword(PvlKeyword("EquatorialRadius", "6.0"), PvlContainer::Replace);
  mapping.addKeyword(PvlKeyword("PolarRadius", "1.0"), PvlContainer::Replace);
  cout << label << endl;
  cn1.SetTarget(label);
  cout << "        TargetName = " << cn1.GetTarget() << endl;
+12 −12

File changed.

Contains only whitespace changes.