Commit e5bdacb8 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Removed body radii from control net and control net versioner.

parent 7b0b3f8b
Loading
Loading
Loading
Loading
+12 −59
Original line number Original line Diff line number Diff line
@@ -81,7 +81,6 @@ namespace Isis {
    m_ownPoints = true;
    m_ownPoints = true;


    p_targetName = other.p_targetName;
    p_targetName = other.p_targetName;
    p_targetRadii = other.p_targetRadii;
    p_networkId = other.p_networkId;
    p_networkId = other.p_networkId;
    p_created = other.p_created;
    p_created = other.p_created;
    p_modified = other.p_modified;
    p_modified = other.p_modified;
@@ -245,16 +244,7 @@ namespace Isis {


    FileName cnetFileName(filename);
    FileName cnetFileName(filename);
    ControlNetVersioner versionedReader(cnetFileName, progress);
    ControlNetVersioner versionedReader(cnetFileName, progress);
    if ( versionedReader.hasTargetRadii() ) {
      p_targetName = versionedReader.targetName();
      p_targetRadii.clear();
      foreach (Distance distance, versionedReader.targetRadii()) {
        p_targetRadii.push_back(distance);
      }
    }
    else {
    SetTarget( versionedReader.targetName() );
    SetTarget( versionedReader.targetName() );
    }
    p_networkId   = versionedReader.netId();
    p_networkId   = versionedReader.netId();
    p_userName    = versionedReader.userName();
    p_userName    = versionedReader.userName();
    p_created     = versionedReader.creationDate();
    p_created     = versionedReader.creationDate();
@@ -1741,24 +1731,6 @@ namespace Isis {
    }
    }


    p_targetName = target;
    p_targetName = target;

    p_targetRadii.clear();
    try {
      PvlGroup pvlRadii = Target::radiiGroup(target);
      p_targetRadii.push_back(Distance(pvlRadii["EquatorialRadius"],
                                       Distance::Meters));
      // The method Projection::Radii does not provide the B radius
      p_targetRadii.push_back(Distance(pvlRadii["EquatorialRadius"],
                                       Distance::Meters));
      p_targetRadii.push_back(Distance(pvlRadii["PolarRadius"],
                                       Distance::Meters));
    }
    catch (IException &e) {
      // Fill target radii vector will Null-valued distances
      p_targetRadii.push_back(Distance());
      p_targetRadii.push_back(Distance());
      p_targetRadii.push_back(Distance());
    }
  }
  }




@@ -1777,8 +1749,6 @@ namespace Isis {
    }
    }


    PvlGroup mapping;
    PvlGroup mapping;
    p_targetRadii.clear();
    try {
    if ( (label.hasObject("IsisCube") && label.findObject("IsisCube").hasGroup("Mapping"))
    if ( (label.hasObject("IsisCube") && label.findObject("IsisCube").hasGroup("Mapping"))
         || label.hasGroup("Mapping") ) {
         || label.hasGroup("Mapping") ) {
      mapping = label.findGroup("Mapping", Pvl::Traverse);
      mapping = label.findGroup("Mapping", Pvl::Traverse);
@@ -1786,7 +1756,6 @@ namespace Isis {
    // If radii values don't exist in the labels
    // If radii values don't exist in the labels
    // or if they are set to null,
    // or if they are set to null,
    // try to get target radii using the TargetName or NaifKeywords object values
    // try to get target radii using the TargetName or NaifKeywords object values
      Distance equatorialRadius, polarRadius;
    if (!mapping.hasKeyword("EquatorialRadius")
    if (!mapping.hasKeyword("EquatorialRadius")
        || !mapping.hasKeyword("PolarRadius")) {
        || !mapping.hasKeyword("PolarRadius")) {


@@ -1794,20 +1763,6 @@ namespace Isis {


    }
    }


      equatorialRadius = Distance(mapping["EquatorialRadius"], Distance::Meters);
      polarRadius      = Distance(mapping["PolarRadius"],      Distance::Meters);

      p_targetRadii.push_back(equatorialRadius);
      p_targetRadii.push_back(equatorialRadius);
      p_targetRadii.push_back(polarRadius);
    }
    catch (IException &e) {
      // leave equatorialRadius and polarRadius as Null-valued distances if this fails
      p_targetRadii.push_back(Distance());
      p_targetRadii.push_back(Distance());
      p_targetRadii.push_back(Distance());
    }

    if (mapping.hasKeyword("TargetName")) {
    if (mapping.hasKeyword("TargetName")) {
      p_targetName = mapping["TargetName"][0];
      p_targetName = mapping["TargetName"][0];
    }
    }
@@ -1843,7 +1798,6 @@ namespace Isis {
    }
    }


    p_targetName = target;
    p_targetName = target;
    p_targetRadii = radii;


  }
  }


@@ -1887,7 +1841,6 @@ namespace Isis {
    std::swap(p_cameraValidMeasuresMap, other.p_cameraValidMeasuresMap);
    std::swap(p_cameraValidMeasuresMap, other.p_cameraValidMeasuresMap);
    std::swap(p_cameraRejectedMeasuresMap, other.p_cameraRejectedMeasuresMap);
    std::swap(p_cameraRejectedMeasuresMap, other.p_cameraRejectedMeasuresMap);
    std::swap(p_cameraList, other.p_cameraList);
    std::swap(p_cameraList, other.p_cameraList);
    std::swap(p_targetRadii, other.p_targetRadii);


    // points have parent pointers that need updated too...
    // points have parent pointers that need updated too...
    QHashIterator< QString, ControlPoint * > i(*points);
    QHashIterator< QString, ControlPoint * > i(*points);
@@ -1992,7 +1945,7 @@ namespace Isis {
   * @returns the radii of the target body
   * @returns the radii of the target body
   */
   */
  std::vector<Distance> ControlNet::GetTargetRadii() {
  std::vector<Distance> ControlNet::GetTargetRadii() {
    return p_targetRadii.toStdVector();
    return std::vector<Distance>();
  }
  }




+0 −1
Original line number Original line Diff line number Diff line
@@ -453,7 +453,6 @@ namespace Isis {
      QMap<QString, int> p_cameraRejectedMeasuresMap; //!< A map from serialnumber to
      QMap<QString, int> p_cameraRejectedMeasuresMap; //!< A map from serialnumber to
      //!  #rejected measures
      //!  #rejected measures
      QVector<Isis::Camera *> p_cameraList; //!< Vector of image number to camera
      QVector<Isis::Camera *> p_cameraList; //!< Vector of image number to camera
      QVector<Distance> p_targetRadii;        //!< Radii of target body


      bool m_ownPoints; //!< Specifies ownership of point list. True if owned by this object.
      bool m_ownPoints; //!< Specifies ownership of point list. True if owned by this object.
  };
  };
+27 −137
Original line number Original line Diff line number Diff line
@@ -63,14 +63,6 @@ namespace Isis {
    header.lastModified = net->GetLastModified();
    header.lastModified = net->GetLastModified();
    header.description = net->Description();
    header.description = net->Description();
    header.userName = net->GetUserName();
    header.userName = net->GetUserName();

    std::vector<Distance> netRadii = net->GetTargetRadii();
    if ( netRadii.size() >= 3 &&
         netRadii[0].isValid() &&
         netRadii[1].isValid() &&
         netRadii[2].isValid() ) {
           header.targetRadii = net->GetTargetRadii();
         }
    createHeader(header);
    createHeader(header);
  }
  }


@@ -166,25 +158,6 @@ namespace Isis {
  }
  }




  /**
  * Returns true if the targetRadii in the header has values.
  *
  * @return @b boolean True if the targetRadii in the header is populated.
  */
  bool ControlNetVersioner::hasTargetRadii() const {
    return m_header.targetRadii.empty() ? false : true;
  }

  /**
  * Returns the targetRadii Distance vector located in the header.
  *
  * @return @b std::vector<Distance> A vector containing the target body radii.
  */
  std::vector<Distance> ControlNetVersioner::targetRadii() const {
    return m_header.targetRadii;
  }


  /**
  /**
   * Returns the number of points that have been read in or are ready to write out.
   * Returns the number of points that have been read in or are ready to write out.
   *
   *
@@ -230,16 +203,6 @@ namespace Isis {
    network += PvlKeyword("LastModified", m_header.lastModified);
    network += PvlKeyword("LastModified", m_header.lastModified);
    network += PvlKeyword("Description", m_header.description);
    network += PvlKeyword("Description", m_header.description);


    // Grab TargetRadii if they exist.
    if (!m_header.targetRadii.empty()) {
        PvlKeyword pvlRadii("TargetRadii");
        for (uint i = 0; i < m_header.targetRadii.size(); i++) {
          pvlRadii += toString(m_header.targetRadii[i].meters());
        }
        network += pvlRadii;
      }
    // optionally add username to output?

    // This is the Pvl version we're converting to
    // This is the Pvl version we're converting to
    network += PvlKeyword("Version", "5");
    network += PvlKeyword("Version", "5");


@@ -364,8 +327,6 @@ namespace Isis {
          matrix += toString(aprioriCovarianceMatrix(1, 2));
          matrix += toString(aprioriCovarianceMatrix(1, 2));
          matrix += toString(aprioriCovarianceMatrix(2, 2));
          matrix += toString(aprioriCovarianceMatrix(2, 2));


          if ( !m_header.targetRadii.empty() ) {

          if ( aprioriSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
          if ( aprioriSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
               && aprioriSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
               && aprioriSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
               && aprioriSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
               && aprioriSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
@@ -379,7 +340,6 @@ namespace Isis {
            + " <meters>";
            + " <meters>";
            matrix.addComment(sigmas);
            matrix.addComment(sigmas);
          }
          }
          }


          // If the covariance matrix has a value, add it to the PVL point.
          // If the covariance matrix has a value, add it to the PVL point.
          if ( aprioriCovarianceMatrix(0, 0) != 0.0
          if ( aprioriCovarianceMatrix(0, 0) != 0.0
@@ -443,8 +403,6 @@ namespace Isis {
          matrix += toString(adjustedCovarianceMatrix(1, 2));
          matrix += toString(adjustedCovarianceMatrix(1, 2));
          matrix += toString(adjustedCovarianceMatrix(2, 2));
          matrix += toString(adjustedCovarianceMatrix(2, 2));


          if ( !m_header.targetRadii.empty() ) {

          if ( adjustedSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
          if ( adjustedSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
               && adjustedSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
               && adjustedSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
               && adjustedSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
               && adjustedSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
@@ -459,7 +417,6 @@ namespace Isis {


          matrix.addComment(sigmas);
          matrix.addComment(sigmas);
          }
          }
          }
          // If the covariance matrix has a value, add it to the PVL point.
          // If the covariance matrix has a value, add it to the PVL point.
          if ( adjustedCovarianceMatrix(0, 0) != 0.0
          if ( adjustedCovarianceMatrix(0, 0) != 0.0
               || adjustedCovarianceMatrix(0, 1) != 0.0
               || adjustedCovarianceMatrix(0, 1) != 0.0
@@ -863,16 +820,6 @@ namespace Isis {
      header.lastModified = network.findKeyword("LastModified")[0];
      header.lastModified = network.findKeyword("LastModified")[0];
      header.description = network.findKeyword("Description")[0];
      header.description = network.findKeyword("Description")[0];
      header.userName = network.findKeyword("UserName")[0];
      header.userName = network.findKeyword("UserName")[0];
      if (network.hasKeyword("TargetRadii")) {
        header.targetRadii.clear();
        for (int i = 0; i < network.findKeyword("TargetRadii").size(); i++) {
          Distance distance = Distance(toDouble(network.findKeyword("TargetRadii")[i]),
                                           Distance::Meters);
          if ( distance.isValid() ) {
            header.targetRadii.push_back(distance);
          }
        }
      }
      createHeader(header);
      createHeader(header);
    }
    }
    catch (IException &e) {
    catch (IException &e) {
@@ -1255,15 +1202,6 @@ namespace Isis {
      header.lastModified = protoHeader.lastmodified().c_str();
      header.lastModified = protoHeader.lastmodified().c_str();
      header.description = protoHeader.description().c_str();
      header.description = protoHeader.description().c_str();
      header.userName = protoHeader.username().c_str();
      header.userName = protoHeader.username().c_str();
      if ( protoHeader.targetradii_size() >= 3 ) {
        header.targetRadii.clear();
        for (int i = 0; i < protoHeader.targetradii_size(); i++) {
          Distance distance = Distance(protoHeader.targetradii(i), Distance::Meters);
          if ( distance.isValid() ) {
            header.targetRadii.push_back(distance);
          }
        }
      }
      createHeader(header);
      createHeader(header);
    }
    }
    catch (IException &e) {
    catch (IException &e) {
@@ -1558,16 +1496,11 @@ namespace Isis {


      controlPoint->SetAdjustedSurfacePoint(adjustedSurfacePoint);
      controlPoint->SetAdjustedSurfacePoint(adjustedSurfacePoint);
    }
    }
    if (  !m_header.targetRadii.empty() &&
          m_header.targetRadii[0].isValid() &&
          m_header.targetRadii[1].isValid() &&
          m_header.targetRadii[2].isValid() ) {


    SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
    SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
    SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
    SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
    controlPoint->SetAdjustedSurfacePoint(adjustedSurfacePoint);
    controlPoint->SetAdjustedSurfacePoint(adjustedSurfacePoint);
    controlPoint->SetAprioriSurfacePoint(aprioriSurfacePoint);
    controlPoint->SetAprioriSurfacePoint(aprioriSurfacePoint);
    }


    // adding measure information
    // adding measure information
    for (int m = 0 ; m < protoPoint.measures_size(); m++) {
    for (int m = 0 ; m < protoPoint.measures_size(); m++) {
@@ -1703,28 +1636,6 @@ namespace Isis {
    if ( m_header.targetName.startsWith("MRO/") ) {
    if ( m_header.targetName.startsWith("MRO/") ) {
      m_header.targetName = "Mars";
      m_header.targetName = "Mars";
    }
    }

    if ( m_header.targetRadii.empty() ) {
      try {
          // attempt to get target radii values...
          // The target body raii values are read from the PvlV0005 and BinaryV0005
          // Networks. In the event these values weren't read (from an older network)
          // then we must grab them from the Target::radii group.
          if ( !m_header.targetName.isEmpty() ) {

            PvlGroup pvlRadii = Target::radiiGroup(m_header.targetName);
            m_header.targetRadii.push_back(Distance(pvlRadii["EquatorialRadius"],
                                             Distance::Meters));
            m_header.targetRadii.push_back(Distance(pvlRadii["EquatorialRadius"],
                                             Distance::Meters));
            m_header.targetRadii.push_back(Distance(pvlRadii["PolarRadius"],
                                             Distance::Meters));
          }
       }
       catch (IException &e) {
         // do nothing
       }
    }
  }
  }




@@ -1769,12 +1680,6 @@ namespace Isis {
      protobufHeader.set_description(m_header.description.toLatin1().data());
      protobufHeader.set_description(m_header.description.toLatin1().data());
      protobufHeader.set_username(m_header.userName.toLatin1().data());
      protobufHeader.set_username(m_header.userName.toLatin1().data());


      if ( !m_header.targetRadii.empty() ) {
        for (uint i = 0; i < m_header.targetRadii.size(); i++) {
          protobufHeader.add_targetradii(m_header.targetRadii[i].meters());
        }
      }

      streampos coreHeaderSize = protobufHeader.ByteSize();
      streampos coreHeaderSize = protobufHeader.ByteSize();


      Pvl p;
      Pvl p;
@@ -1798,15 +1703,6 @@ namespace Isis {
      netInfo.addComment("This group is for informational purposes only");
      netInfo.addComment("This group is for informational purposes only");
      netInfo += PvlKeyword("NetworkId", protobufHeader.networkid().c_str());
      netInfo += PvlKeyword("NetworkId", protobufHeader.networkid().c_str());
      netInfo += PvlKeyword("TargetName", protobufHeader.targetname().c_str());
      netInfo += PvlKeyword("TargetName", protobufHeader.targetname().c_str());

          // Grab TargetRadii if they exist.
          if (!m_header.targetRadii.empty()) {
              PvlKeyword pvlRadii("TargetRadii");
              for (uint i = 0; i < m_header.targetRadii.size(); i++) {
                pvlRadii += toString(m_header.targetRadii[i].meters());
              }
              netInfo += pvlRadii;
            }
      netInfo += PvlKeyword("UserName", protobufHeader.username().c_str());
      netInfo += PvlKeyword("UserName", protobufHeader.username().c_str());
      netInfo += PvlKeyword("Created", protobufHeader.created().c_str());
      netInfo += PvlKeyword("Created", protobufHeader.created().c_str());
      netInfo += PvlKeyword("LastModified", protobufHeader.lastmodified().c_str());
      netInfo += PvlKeyword("LastModified", protobufHeader.lastmodified().c_str());
@@ -1847,12 +1743,6 @@ namespace Isis {
    protobufHeader.set_description(m_header.description.toLatin1().data());
    protobufHeader.set_description(m_header.description.toLatin1().data());
    protobufHeader.set_username(m_header.userName.toLatin1().data());
    protobufHeader.set_username(m_header.userName.toLatin1().data());


    if ( !m_header.targetRadii.empty() ) {
      for (uint i = 0; i < m_header.targetRadii.size(); i++) {
        protobufHeader.add_targetradii(m_header.targetRadii[i].meters());
      }
    }

    // Write out the header
    // Write out the header
    if ( !protobufHeader.SerializeToOstream(output) ) {
    if ( !protobufHeader.SerializeToOstream(output) ) {
      QString msg = "Failed to write output control network file.";
      QString msg = "Failed to write output control network file.";
+1 −9
Original line number Original line Diff line number Diff line
@@ -409,6 +409,7 @@ namespace Isis {
   *   @history 2018-04-05 Adam Goins - Added hasTargetRadii() and targetRadii() to the versioner
   *   @history 2018-04-05 Adam Goins - Added hasTargetRadii() and targetRadii() to the versioner
   *                           so that these values can be grabbed from a ControlNet on read.
   *                           so that these values can be grabbed from a ControlNet on read.
   *                           Also Fixes #5361.
   *                           Also Fixes #5361.
   *   @history 2018-07-03 Jesse Mapel - Removed target radii from versioner. References #5457.
   */
   */
  class ControlNetVersioner {
  class ControlNetVersioner {


@@ -423,8 +424,6 @@ namespace Isis {
      QString lastModificationDate() const;
      QString lastModificationDate() const;
      QString description() const;
      QString description() const;
      QString userName() const;
      QString userName() const;
      bool hasTargetRadii() const;
      std::vector<Distance> targetRadii() const;


      int numPoints() const;
      int numPoints() const;
      ControlPoint *takeFirstPoint();
      ControlPoint *takeFirstPoint();
@@ -475,13 +474,6 @@ namespace Isis {
        QString description;
        QString description;
        //! The name of the user or program that last modified the control network
        //! The name of the user or program that last modified the control network
        QString userName;
        QString userName;
        /**
         * The equatorial radius of the target body
         * used to convert from spherical to rectangular coordinates
         */

         std::vector<Distance> targetRadii;

      };
      };


      //! Typedef for consistent naming of containers for version 2
      //! Typedef for consistent naming of containers for version 2