Commit bd8429d2 authored by Tyler Wilson's avatar Tyler Wilson
Browse files

PROG: Updated documentation/coding standards for CorrelationMatrix.cpp/.h

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6766 41f8697f-d340-4b68-9986-7bafba869bb8
parent 4d0f9129
Loading
Loading
Loading
Loading
+34 −48
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ namespace Isis {
   *
   * @throws IException::User "Could not find the Correlation Matrix .dat file name."
   *
   * @throws IExceptoin::User"Could not get Images and Parameters from ImagesAndParameters group."
   * @throws IException::User "Could not get Images and Parameters from ImagesAndParameters group."
   *
   */
  CorrelationMatrix::CorrelationMatrix(PvlObject storedMatrixData) {
@@ -111,9 +111,9 @@ namespace Isis {


  /**
   * Copy Constructor
   * @brief Copy Constructor
   *
   * @param other The CorrelationMatrix to copy
   * @param other The CorrelationMatrix to copy.
   */
  CorrelationMatrix::CorrelationMatrix(const CorrelationMatrix &other) {
    m_imagesAndParameters = new QMap<QString, QStringList>(*other.m_imagesAndParameters);
@@ -148,12 +148,12 @@ namespace Isis {


  /**
   * Equal Operator
   * @ brief Equal Operator
   *
   * Should this call the copy constructor???
   *
   * @param other The matrix to assign to this matrix.
   * @return CorrelationMatrix This new matrix.
   * @return @b CorrelationMatrix Returns the new matrix.
   */
  CorrelationMatrix &CorrelationMatrix::operator=(const CorrelationMatrix &other) {

@@ -186,7 +186,7 @@ namespace Isis {


  /**
  * @brief This mehtod reads the covariance matrix in from a file,
  * @description This method reads the covariance matrix in from a file,
  * one SparseBlockColumnMatrix at a time.  It then stores the diagonal values from that column
  * and computes the correlation values. The resulting SparseBlockMatrix is written to a
  * new file, one SparseBlockColumnMatrix at a time.
@@ -273,8 +273,8 @@ namespace Isis {


  /**
   * This method will open the correlation matrix file and read in the blocks that apply to
   *   the requested area. It will populate m_visibleElements.
   * @description This method will open the correlation matrix file and read in the blocks that
   * apply to the requested area. It will populate m_visibleElements.
   *
   * @param x fisrt coordinate of the location in the matrix that the user wants to see.
   * @param y second coordinate of the location in the matrix that the user wants to see.
@@ -309,7 +309,7 @@ namespace Isis {
   * @brief See if the correlation matrix has already been calculated by checking to see if
   *   the correlation matrix file has been created.
   *
   * @return true if the correlation matrix has already been set.
   * @return @b bool Returnns True if the correlation matrix has already been set.
   */
  bool CorrelationMatrix::isValid() {

@@ -318,15 +318,12 @@ namespace Isis {

  }



  /**
   * This is used to make sure the covariance matrix exists. If it doesn't this class is not
   * valid.
   * @description This is used to make sure the covariance matrix exists.
   * If it doesn't this class is not valid. If this file exists, we can compute the
   * correlation matrix.
   *
   * If this file exists, we can compute the correlation matrix.
   *
   * @return bool True if the covariance matrix has been created.
   * @return @b bool Returns True if the covariance matrix exists, and False if it does not.
   */
  bool CorrelationMatrix::hasCovMat() {
    return !(m_covarianceFileName->name() == "");
@@ -336,8 +333,7 @@ namespace Isis {

  // Set Methods
  /**
   * Set the qmap of images and parameters.
   *
   * @brief Set the qmap of images and parameters.
   * @param correlationFileName The FileName of the stored correlation matrix data.
   */
  void CorrelationMatrix::setCorrelationFileName(FileName correlationFileName) {
@@ -352,8 +348,7 @@ namespace Isis {


  /**
   *Set the qmap of images and parameters.
   *
   * @brief Set the qmap of images and parameters.
   * @param  covarianceFileName  The FileName of the stored covariance matrix data.
   */
  void CorrelationMatrix::setCovarianceFileName(FileName covarianceFileName) {
@@ -393,7 +388,7 @@ namespace Isis {
  /**
   * @brief Public access for the correlation matrix file name.
   *
   * @return A pointer to the FileName of the correlation matrix data file.
   * @return @b FileName  The FileName of the correlation matrix data file.
   */
  FileName CorrelationMatrix::correlationFileName() {
    return *m_correlationFileName;
@@ -402,9 +397,9 @@ namespace Isis {


  /**
   * Public access for the covariance matrix file name.
   * @brief Public access for the covariance matrix file name.
   *
   * @return A pointer to the FileName of the covariance data file.
   * @return @b FileName The FileName of the covariance data file.
   */
  FileName CorrelationMatrix::covarianceFileName() {
    return *m_covarianceFileName;
@@ -413,10 +408,10 @@ namespace Isis {


  /**
   * Public access for the qmap of images and parameters.
   * @brief Public access for the qmap of images and parameters.
   *
   * @return  A pointer to the QMap containing a list of images (the keys) and their
   * associated parameter values.
   * @return  @b *QMap<QString,QStringList>  A pointer to the QMap structure containing a list
   * of images (the keys) and their associated parameter values.
   */
  QMap<QString, QStringList> *CorrelationMatrix::imagesAndParameters() {
    return m_imagesAndParameters;
@@ -425,7 +420,7 @@ namespace Isis {


  /**
   * This method will read the matrix in from the file and hold on to the whole thing.
   * @description This method will read the matrix in from the file and hold on to the whole thing.
   * This will only be used when the matrix is small enough that this will be useful.
   *
   */
@@ -444,7 +439,7 @@ namespace Isis {


  /**
   * This method will be used when the matrix is too big to display the whole thing.
   * @description This method will be used when the matrix is too big to display the whole thing.
   * It will read in the block we want to see and the two blocks for the diagonals that belong to
   * the right images.
   */
@@ -455,7 +450,7 @@ namespace Isis {

  /**
   * @brief Get the visible part of the matrix.
   * @return Returns a QList of the non-empty diagonal blocks of the correlation matrix.
   * @return @b QList Returns a list of the non-empty diagonal blocks of the correlation matrix.
   */
  QList<SparseBlockColumnMatrix> *CorrelationMatrix::visibleBlocks() {
    return m_visibleBlocks;
@@ -464,8 +459,8 @@ namespace Isis {


  /**
   * @brief This method creates a pvl group with the information necessary to recreate this correlation
   * matrix.
   * @description This method creates a Pvl group with the information necessary to recreate
   * this correlation matrix.
   *
   * Object = CorrelationMatrixData
   *   CovarianceMatrixFileName = /location/covarianceTmpFileName.dat
@@ -478,7 +473,7 @@ namespace Isis {
   *   End_Group
   * End_Object
   * 
   * @return PvlGroup The info needed to recreate this correlation matrix.
   * @return @b PvlGroup Returns the information needed to recreate this correlation matrix.
   */
  PvlObject CorrelationMatrix::pvlObject() {
    PvlObject corrMatInfo("CorrelationMatrixData");
@@ -501,11 +496,9 @@ namespace Isis {
   * @brief Writes CorrelationMatrix data to the output stream and returns this stream
   * to the user.
   * @param stream  The input stream containing the data.
   * @return The same stream but now containing the matrix data.
   * @return @b QDataStream Returns the output stream.
   */



  QDataStream &CorrelationMatrix::write(QDataStream &stream) const {
    // QMaps
    stream << *m_imagesAndParameters;
@@ -521,11 +514,8 @@ namespace Isis {
   * @brief Reads CorrelationMatrix data from the input stream and places the data
   * in member variables.
   * @param stream  The input input stream containing the data.
   * @return Also the input stream which is returned back to the user should they need it.
   * @return @b QDataStream Returns the output data stream.
   */



    QDataStream &CorrelationMatrix::read(QDataStream &stream) {
    // QMaps
    QMap<QString, QStringList> imagesAndParameters;
@@ -564,25 +554,21 @@ namespace Isis {
  }

  /**
   * @brief operator <<
   * @param stream The output stream upon which the matrix data is written
   * @brief The operator <<  writes matrix data to a QDataStream.
   * @param stream The output stream upon which the matrix data is written.
   * @param matrix The CorrelationMatrix containing the data.
   * @return The output stream containing the matrix data.
   * @return @b QDataStream Returns the output stream containing the matrix data.
   */


  QDataStream &operator<<(QDataStream &stream, const CorrelationMatrix &matrix) {
    return matrix.write(stream);
  }

  /**
   * @brief operator >>
   * @brief The operator >> reads matrix data from a QDataStream.
   * @param stream  The input stream containing the CorrelationMatrix data.
   * @param matrix  The matrix which is going to be overwritten by the input stream.
   * @return  The output stream containing the matrix data.
   * @return @b QDataStream Returns the output stream containing the matrix data.
   */


  QDataStream &operator>>(QDataStream &stream, CorrelationMatrix &matrix) {
    return matrix.read(stream);
  }
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ namespace Isis {
   *                           There was also an issue with a QMap data structure not being
   *                           initialized, resulting in a segmentation fault.  Also added
   *                           testing for exceptions being thrown in this constructor,
   *                           as well as the function computeCorrelationMatrix. Fixes #3999.
   *                           as well as the function computeCorrelationMatrix. Fixes #3997,3999.
   */
  class CorrelationMatrix {
    public:
+54 −32
Original line number Diff line number Diff line
@@ -8,19 +8,25 @@

#include <hdf5.h>
#include <hdf5_hl.h> // in the hdf5 library
#include <hdf5.h>

//#include "Distance.h"

#include "Camera.h"
#include "GuiCameraDisplayProperties.h"
#include "IString.h"
#include "Project.h"
#include "PvlKeyword.h"
#include "PvlObject.h"
#include "Camera.h"
#include "GuiCameraDisplayProperties.h"
#include "XmlStackedHandlerReader.h"

namespace Isis {


/**
   * @brief The constructor for this class.
   * @param camera  A traditional Isis::Camera object which we are wrapping in this class.
   * @param parent  A pointer to the object instantiating this object.
   */

  GuiCamera::GuiCamera(Camera *camera, QObject *parent) : QObject(parent) {
    m_id = NULL;

@@ -39,8 +45,7 @@ namespace Isis {

    QString displayStr = m_spacecraftNameShort + "/" + m_instrumentNameShort;

    m_displayProperties
        = new GuiCameraDisplayProperties(displayStr, this);
    m_displayProperties = new GuiCameraDisplayProperties(displayStr, this);

    m_id = new QUuid(QUuid::createUuid());
  }
@@ -48,9 +53,9 @@ namespace Isis {


//  GuiCamera::GuiCamera(Project *project, XmlStackedHandlerReader *xmlReader,
//                         QObject *parent) : QObject(parent) {   // TODO: does xml stuff need project???
//                         QObject *parent) : QObject(parent) {
// TODO: does xml stuff need project???
//    m_id = NULL;

//    xmlReader->pushContentHandler(new XmlHandler(this, project));
//    xmlReader->setErrorHandler(new XmlHandler(this, project));
//  }
@@ -63,7 +68,8 @@ namespace Isis {
//    m_bodyCode = new SpiceInt(*src.m_bodyCode);
//
//    m_radii.resize(3, Distance());
//    m_sigmaRadii.resize(3, Distance(3.0, Distance::Kilometers)); // TODO - radii sigma fudged for now
//    m_sigmaRadii.resize(3, Distance(3.0, Distance::Kilometers));
// TODO - radii sigma fudged for now
//
//    for (int i = 0; i < 3; i++) {
//      m_radii[i] = src.m_radii[i];
@@ -79,6 +85,10 @@ namespace Isis {



  /**
   * @brief The Destructor
   */

  GuiCamera::~GuiCamera() {
    delete m_id;
    m_id = NULL;
@@ -86,29 +96,22 @@ namespace Isis {

  
//  GuiCamera &GuiCamera::operator=(const GuiCamera &src) {

//    if (&src != this) {

//      delete m_id;
//      m_id = NULL;
//      m_id = new QUuid(src.m_id->toString());
//    }

//    return *this;
//  }


//  Camera *GuiCamera::camera() {
//      return m_camera;
//  }


  /**
   * Compares two Target Body objects to see if they are equal
   *
   * @brief Compares two Target Body objects to see if they are equal
   * @param srcGuiCamera GuiCamera object to compare against
   *
   * @return bool Returns true if the objects are equal, false if not
   * @return @b bool Returns True if the objects are equal, False if not.
   */
  bool GuiCamera::operator== (const GuiCamera &srcGuiCamera) const {

@@ -119,11 +122,17 @@ namespace Isis {
  }



  /*
  GuiCameraDisplayProperties *GuiCamera::displayProperties() {
    return m_displayProperties;
  }
  */


  /**
   * @brief Retrieves the display properties of the camera.
   * @return GuiCameraDisplayProperties
   */
  const GuiCameraDisplayProperties *GuiCamera::displayProperties() const {
    return m_displayProperties;
  }
@@ -346,7 +355,8 @@ namespace Isis {
//      else if (localName == "bundleResults") {
//        delete m_xmlHandlerBundleResults;
//        m_xmlHandlerBundleResults = NULL;
//        m_xmlHandlerBundleResults = new BundleResults(m_xmlHandlerProject, reader()); //TODO: need to add constructor for this???
//        m_xmlHandlerBundleResults = new BundleResults(m_xmlHandlerProject, reader());
//TODO: need to add constructor for this???
//      }
//      else if (localName == "imageList") {
//        m_xmlHandlerImages->append(new ImageList(m_xmlHandlerProject, reader()));
@@ -396,30 +406,41 @@ namespace Isis {


  /**
   * Get a unique, identifying string associated with this GuiCamera object.
   *
   * @return A unique ID for this GuiCamera object
   * @brief Retrieves a unique, identifying string associated with this GuiCamera object.
   * @return @b QString returns m_id
   */
  QString GuiCamera::id() const {
    return m_id->toString().remove(QRegExp("[{}]"));
  }


  /**
   * @brief Retrieves an abbreviated version for the name of the instrument.
   * @return @b QString Returns m_instrumentNameShort.
   */
  QString GuiCamera::instrumentNameShort() {
    return m_instrumentNameShort;
  }


  /**
   * @brief Retrieves a long version for the name of the instrument.
   * @return @b QString Returns m_instrumentNameLong.
   */
  QString GuiCamera::instrumentNameLong() {
    return m_instrumentNameLong;
  }


  /**
   * @brief Retrieves an abbbreviated name for the spacecraft.
   * @return @b QString Returns m_spacecraftNameShort.
   */
  QString GuiCamera::spacecraftNameShort() {
    return m_spacecraftNameShort;
  }


  /**
   * @brief Retrieves the full name of the spacecraft.
   * @return @b QString Returns m_spacecraftNameLong.
   */
  QString GuiCamera::spacecraftNameLong() {
    return m_spacecraftNameLong;
  }
@@ -462,9 +483,8 @@ namespace Isis {


//  void GuiCamera::savehdf5(FileName outputfilename) const {
//    const H5std_string  hdfFileName(outputfilename.expanded().toStdString()); //Is this the right way to have a dynamic file name?  What about PATH?
    
    
//    const H5std_string  hdfFileName(outputfilename.expanded().toStdString());
//Is this the right way to have a dynamic file name?  What about PATH?
//    // Try block to detect exceptions raised by any of the calls inside it
//    try {
//      /*
@@ -485,10 +505,12 @@ namespace Isis {
//      H5LTset_attribute_string(fileId, objectName.toLatin1(), "controlNetworkFileName",
//                               m_controlNetworkFileName->expanded().toLatin1());

//      //??? H5::Group settingsGroup = H5::Group(hdfFile.createGroup("/GuiCamera/BundleSettings"));//???
//      //??? H5::Group settingsGroup = H5::Group(hdfFile.createGroup("/GuiCamera/BundleSettings"));
//        ???
//      //???H5::Group settingsGroup = hdfFile.createGroup("/GuiCamera/BundleSettings");
//      QString groupName = objectName + "/BundleSettings";
//      hid_t groupId = H5Gcreate(fileId, groupName.toLatin1(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//      hid_t groupId = H5Gcreate(fileId, groupName.toLatin1(), H5P_DEFAULT, H5P_DEFAULT,
//      H5P_DEFAULT);
//      m_settings->savehdf5(groupId, groupName.toLatin1());
//      groupName = objectName + "/BundleResults";
//      H5::Group resultsGroup  = H5::Group(hdfFile.createGroup(groupName.toLatin1()));
+29 −12
Original line number Diff line number Diff line
@@ -24,32 +24,37 @@
 *   http://www.usgs.gov/privacy.html.
 */


#include <vector>


#include <QList>
#include <QObject>
#include <QSharedPointer>
#include <QString>

//#include "Angle.h"
//#include "Distance.h"
#include "XmlStackedHandler.h"

#include <vector>

#include <SpiceUsr.h>
#include <SpiceZfc.h>
#include <SpiceZmc.h>


#include "XmlStackedHandler.h"





class QDataStream;
class QUuid;
class QXmlStreamWriter;

namespace Isis {
  //class Distance;

  class Camera;
  class FileName;
  class GuiCameraDisplayProperties;
  class Project;  // TODO: does xml stuff need project???
  class PvlObject;  
  class Camera;
  class GuiCameraDisplayProperties;
  class XmlStackedHandlerReader;

  /**
@@ -67,6 +72,9 @@ namespace Isis {
   *   @history 2015-06-23 Ken Edmundson - Original version.
   *   @history 2015-10-14 Jeffrey Covington - Declared GuiCameraQsp as a Qt
   *                           metatype for use with QVariant.
   *   @history 2016-06-08 Tyler Wilson - Added documentation to some functions
   *                           and corrected the formatting.  Fixes #3997.
   *
   *  
   */
  class GuiCamera : public QObject {
@@ -79,7 +87,7 @@ namespace Isis {

      bool operator==(const GuiCamera &srcGuiCamera) const;

      GuiCameraDisplayProperties *displayProperties();
      //GuiCameraDisplayProperties *displayProperties();
      const GuiCameraDisplayProperties *displayProperties() const;

      QString id() const;
@@ -103,8 +111,10 @@ namespace Isis {
//      Distance sigmaRadiusC() const;
//      Distance sigmaMeanRadius() const;

//      void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;  // TODO: does xml stuff need project and newRoot???
//      void save(QXmlStreamWriter &stream, const Project *project) const;  // TODO: does xml stuff need project???
//      void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
//      TODO: does xml stuff need project and newRoot???
//      void save(QXmlStreamWriter &stream, const Project *project) const;
//      TODO: does xml stuff need project???

//      QDataStream &write(QDataStream &stream) const;
//      QDataStream &read(QDataStream &stream);
@@ -170,6 +180,13 @@ namespace Isis {
      QString m_instrumentNameLong;
  };

  /**
   * @description GuiCameraQsp  Represents a smart pointer to a GuiCamera object.
   * It behaves exactly like a normal pointer, but it is thread-safe and it will delete the pointer
   *  it is holding when it goes out of scope, provided no other QSharedPointer objects
   * are referencing it.
   */

  typedef QSharedPointer<GuiCamera> GuiCameraQsp;

  // operators to read/write GuiCamera to/from binary data
+73 −16

File changed.

Preview size limit exceeded, changes collapsed.

Loading