Commit 906de12b authored by Tyler Wilson's avatar Tyler Wilson
Browse files

Removed raw data stream serialization from obj classes in qisis/control directories. Fixes #4796.

parent 6cbe1275
Loading
Loading
Loading
Loading
+0 −173
Original line number Diff line number Diff line
@@ -2307,179 +2307,6 @@ namespace Isis {
  }


  /**
   * Writes the BundleResults object to a QDataStream.
   * 
   * @param stream The QDataStream that the BundleResults will be written to.
   * 
   * @return @b QDataStream& A reference to the QDataStream that
   *                         the BundleResults where written to.
   */
  QDataStream &BundleResults::write(QDataStream &stream) const {
    stream << m_id->toString()
           << *m_correlationMatrix
           << (qint32)m_numberFixedPoints
           << (qint32)m_numberIgnoredPoints
           << (qint32)m_numberHeldImages
           << m_rmsXResiduals << m_rmsYResiduals << m_rmsXYResiduals
           << m_rejectionLimit
           << (qint32)m_numberObservations
           << (qint32)m_numberRejectedObservations
           << (qint32)m_numberUnknownParameters
           << (qint32)m_numberImageParameters
           << (qint32)m_numberConstrainedImageParameters
           << (qint32)m_numberConstrainedPointParameters
           << (qint32)m_numberConstrainedTargetParameters
           << (qint32)m_degreesOfFreedom
           << m_sigma0
           << m_elapsedTime << m_elapsedTimeErrorProp
           << m_converged
           << m_rmsImageSampleResiduals << m_rmsImageLineResiduals
           << m_rmsImageResiduals
           << m_rmsImageXSigmas << m_rmsImageYSigmas << m_rmsImageZSigmas
           << m_rmsImageRASigmas << m_rmsImageDECSigmas << m_rmsImageTWISTSigmas
           << m_minSigmaLatitudeDistance.meters()
           << m_maxSigmaLatitudeDistance.meters()
           << m_minSigmaLongitudeDistance.meters()
           << m_maxSigmaLongitudeDistance.meters()
           << m_minSigmaRadiusDistance.meters()
           << m_maxSigmaRadiusDistance.meters()
           << m_minSigmaLatitudePointId        
           << m_maxSigmaLatitudePointId        
           << m_minSigmaLongitudePointId       
           << m_maxSigmaLongitudePointId       
           << m_minSigmaRadiusPointId          
           << m_maxSigmaRadiusPointId          
           << m_rmsSigmaLatitudeStats << m_rmsSigmaLongitudeStats << m_rmsSigmaRadiusStats
           << m_maximumLikelihoodFunctions
           << (qint32)m_maximumLikelihoodIndex << *m_cumPro << *m_cumProRes
           << m_maximumLikelihoodMedianR2Residuals;
    return stream;
  }


  /**
   * Reads the data from a QDataStream into the BundleResults object.
   * 
   * @param stream The QDataStream to read from.
   * 
   * @return @b QDataStream& A reference to the stream after reading from it.
   */
  QDataStream &BundleResults::read(QDataStream &stream) {
    QString id;
    CorrelationMatrix correlationMatrix;
    qint32 numberFixedPoints, numberIgnoredPoints, numberHeldImages, numberRejectedObservations,
           numberObservations, numberImageParameters, numberConstrainedPointParameters,
           numberConstrainedImageParameters, numberConstrainedTargetParameters,
           numberUnknownParameters, degreesOfFreedom, maximumLikelihoodIndex;
    double minSigmaLatitudeDistance, maxSigmaLatitudeDistance, minSigmaLongitudeDistance,
           maxSigmaLongitudeDistance, minSigmaRadiusDistance, maxSigmaRadiusDistance;   
    StatCumProbDistDynCalc cumPro;
    StatCumProbDistDynCalc cumProRes;

    stream >> id;
    stream >> correlationMatrix;
    stream >> numberFixedPoints;
    stream >> numberIgnoredPoints;
    stream >> numberHeldImages;
    stream >> m_rmsXResiduals >> m_rmsYResiduals >> m_rmsXYResiduals;
    stream >> m_rejectionLimit;
    stream >> numberObservations;
    stream >> numberRejectedObservations;
    stream >> numberUnknownParameters;
    stream >> numberImageParameters;
    stream >> numberConstrainedImageParameters;
    stream >> numberConstrainedPointParameters;
    stream >> numberConstrainedTargetParameters;
    stream >> degreesOfFreedom;
    stream >> m_sigma0;
    stream >> m_elapsedTime >> m_elapsedTimeErrorProp;
    stream >> m_converged;
    stream >> m_rmsImageSampleResiduals >> m_rmsImageLineResiduals;
    stream >> m_rmsImageResiduals;
    stream >> m_rmsImageXSigmas >> m_rmsImageYSigmas >> m_rmsImageZSigmas;
    stream >> m_rmsImageRASigmas >> m_rmsImageDECSigmas >> m_rmsImageTWISTSigmas;
    stream >> minSigmaLatitudeDistance;
    stream >> maxSigmaLatitudeDistance;
    stream >> minSigmaLongitudeDistance;
    stream >> maxSigmaLongitudeDistance;
    stream >> minSigmaRadiusDistance;
    stream >> maxSigmaRadiusDistance;
    stream >> m_minSigmaLatitudePointId;   
    stream >> m_maxSigmaLatitudePointId;   
    stream >> m_minSigmaLongitudePointId;  
    stream >> m_maxSigmaLongitudePointId;  
    stream >> m_minSigmaRadiusPointId;     
    stream >> m_maxSigmaRadiusPointId;     
    stream >> m_rmsSigmaLatitudeStats >> m_rmsSigmaLongitudeStats >> m_rmsSigmaRadiusStats;
    stream >> m_maximumLikelihoodFunctions;
    stream >> maximumLikelihoodIndex;
    stream >> cumPro >> cumProRes;
    stream >> m_maximumLikelihoodMedianR2Residuals;

    m_id = NULL;
    m_id = new QUuid(id);

    m_correlationMatrix = NULL;
    m_correlationMatrix = new CorrelationMatrix(correlationMatrix);

    m_numberFixedPoints                 = (int)numberFixedPoints;
    m_numberIgnoredPoints               = (int)numberIgnoredPoints;
    m_numberHeldImages                  = (int)numberHeldImages;
    m_numberRejectedObservations        = (int)numberRejectedObservations;
    m_numberObservations                = (int)numberObservations;
    m_numberImageParameters             = (int)numberImageParameters;
    m_numberConstrainedPointParameters  = (int)numberConstrainedPointParameters;
    m_numberConstrainedImageParameters  = (int)numberConstrainedImageParameters;
    m_numberConstrainedTargetParameters = (int)numberConstrainedTargetParameters;
    m_numberUnknownParameters           = (int)numberUnknownParameters;
    m_degreesOfFreedom                  = (int)degreesOfFreedom;
    m_maximumLikelihoodIndex            = (int)maximumLikelihoodIndex;

    m_minSigmaLatitudeDistance.setMeters(minSigmaLatitudeDistance); 
    m_maxSigmaLatitudeDistance.setMeters(maxSigmaLatitudeDistance); 
    m_minSigmaLongitudeDistance.setMeters(minSigmaLongitudeDistance);
    m_maxSigmaLongitudeDistance.setMeters(maxSigmaLongitudeDistance);
    m_minSigmaRadiusDistance.setMeters(minSigmaRadiusDistance);   
    m_maxSigmaRadiusDistance.setMeters(maxSigmaRadiusDistance);   

    m_cumPro = NULL;
    m_cumPro = new StatCumProbDistDynCalc(cumPro);

    m_cumProRes = NULL;
    m_cumProRes = new StatCumProbDistDynCalc(cumProRes);
    
    return stream;
  }


  /**
   * Insertion operator to save the BundleResults object to a QDataStream.
   * 
   * @param stream The QDataStream to write to.
   * @param bundleResults The BundleResults object to save.
   * 
   * @return @b QDataStream& A reference to the QDataStream after saving.
   *
   * @see write
   */
  QDataStream &operator<<(QDataStream &stream, const BundleResults &bundleResults) {
    return bundleResults.write(stream);
  }


  /**
   * Extraction operator to read the BundleResults object from a QDataStream.
   *
   * @param stream The QDataStream to read from.
   * @param bundleResults The BundleResults objec to read to.
   *
   * @return @b QDataStream& A reference to the QDataStream after reading.
   * 
   * @see read
   */
  QDataStream &operator>>(QDataStream &stream, BundleResults &bundleResults) {
    return bundleResults.read(stream);
  } 
  
}
+1 −12
Original line number Diff line number Diff line
@@ -240,9 +240,6 @@ namespace Isis {
      // TODO: does xml stuff need project???
      void save(QXmlStreamWriter &stream, const Project *project) const;
      
      QDataStream &write(QDataStream &stream) const;
      QDataStream &read(QDataStream &stream);


    private:
      /**
@@ -294,14 +291,8 @@ namespace Isis {
       *   when saving to disk).
       */
      QUuid *m_id;
//???      QString m_instrumentId;               //!< The spacecraft instrument id for this observation.
      CorrelationMatrix *m_correlationMatrix; //!< The correlation matrix from the BundleAdjust.

// ???       Statistics m_statsx;                       //!<  x errors
// ???       Statistics m_statsy;                       //!<  y errors
// ???       Statistics m_statsrx;                      //!<  x residuals
// ???       Statistics m_statsry;                      //!<  y residuals
// ???       Statistics m_statsrxy;                     //!< xy residuals

      int m_numberFixedPoints;                //!< number of 'fixed' (ground) points (define)
      // Currently set but unused
@@ -422,9 +413,7 @@ namespace Isis {
      double m_maximumLikelihoodMedianR2Residuals; /**< Median of R^2 residuals.*/ 
       
  };
  // operators to read/write BundleResults to/from binary disk file
  QDataStream &operator<<(QDataStream &stream, const BundleResults &bundleResults);
  QDataStream &operator>>(QDataStream &stream, BundleResults &bundleResults);

};

Q_DECLARE_METATYPE(Isis::BundleResults);
+1 −483

File changed.

Preview size limit exceeded, changes collapsed.

+3 −24
Original line number Diff line number Diff line
@@ -28,10 +28,7 @@
#include <QSharedPointer>
#include <QString>

// hdf5 library
#include <H5Cpp.h>
#include <hdf5_hl.h>
#include <hdf5.h>


// ISIS library
#include "BundleTargetBody.h"
@@ -44,7 +41,7 @@ class QDataStream;
class QUuid;
class QXmlStreamWriter;

using namespace H5;

using namespace Isis;

namespace Isis {
@@ -276,22 +273,6 @@ namespace Isis {

      void save(QXmlStreamWriter &stream, const Project *project) const;

      QDataStream &write(QDataStream &stream) const;
      QDataStream &read(QDataStream &stream);

      void createH5Group(hid_t locationId, 
                         QString locationName) const; //delete
      void parseH5Group(hid_t locationId, 
                        QString locationName);        //delete

      void createH5Group(H5::CommonFG &locationObject, 
                         QString locationName) const;
      H5::Group createH5Group2(H5::Group locationGroup, 
                               QString locationName);
      void openH5Group(H5::CommonFG &locationObject, 
                       QString locationName);
      BundleSettings(H5::CommonFG &locationObject, 
                     QString locationName);

    private:

@@ -403,9 +384,7 @@ namespace Isis {
  //! Definition for a BundleSettingsQsp, a shared pointer to a BundleSettings object.
  typedef QSharedPointer<BundleSettings> BundleSettingsQsp;

  // operators to read/write BundleResults to/from binary data
  QDataStream &operator<<(QDataStream &stream, const BundleSettings &settings);
  QDataStream &operator>>(QDataStream &stream, BundleSettings &settings);

};

Q_DECLARE_METATYPE(Isis::BundleSettingsQsp);
+0 −91
Original line number Diff line number Diff line
@@ -499,8 +499,6 @@ namespace Isis {





  /**
   * @brief Outputs the header for the bundleout_images.csv file
   * @param fpOut The output file stream.
@@ -1634,93 +1632,4 @@ namespace Isis {
    return true;
  }


  /**
   * Writes the data to the stream.
   * 
   * @param stream The stream we are writing to and returning
   * 
   * @return @b QDataStream The stream we wrote to
   */
  QDataStream &BundleSolutionInfo::write(QDataStream &stream) const {
    stream << m_id->toString()
           << m_runTime
           << m_controlNetworkFileName->expanded()
           << *m_settings
           << *m_statisticsResults;
  //TODO add this capability to Image and ImageList
  //          << *m_images;
    return stream;
  }


  /**
   * Reads the data from the stream
   * 
   * @param stream The stream we are reading from
   * 
   * @return @b QDataStream The stream we read from
   */
  QDataStream &BundleSolutionInfo::read(QDataStream &stream) {

    QString id;
    stream >> id;
    delete m_id;
    m_id = NULL;
    m_id = new QUuid(id);

    stream >> m_runTime;

    QString controlNetworkFileName;
    stream >> controlNetworkFileName;
    delete m_controlNetworkFileName;
    m_controlNetworkFileName = NULL;
    m_controlNetworkFileName = new FileName(controlNetworkFileName);

    BundleSettings settings;
    stream >> settings;
    m_settings = BundleSettingsQsp(new BundleSettings(settings));

    BundleResults statisticsResults;
    stream >> statisticsResults;
    delete m_statisticsResults;
    m_statisticsResults = NULL;
    m_statisticsResults = new BundleResults(statisticsResults);

    //TODO add this capability to Image and ImageList
    // QList<ImageList*> imageLists;
    // stream >> imageLists;
    // delete m_images;
    // m_images = NULL;
    // m_images = new QList<ImageList *>(imageLists);

    return stream;
  }


  /**
   * Creates the write operator for BundleSolutionInfo
   * 
   * @param stream The stream we are writing to
   * @param bundleSolutionInfo The BundleSolutionInfo we are writing
   * 
   * @return @b QDataStream The stream we wrote to
   */
  QDataStream &operator<<(QDataStream &stream, const BundleSolutionInfo &bundleSolutionInfo) {
    return bundleSolutionInfo.write(stream);
  }


  /**
   * Creates the read operator for BundleSolutionInfo
   * 
   * @param stream The stream we are reading to
   * @param bundleSolutionInfo The BundleSolutionInfo we are reading
   * 
   * @return @b QDataStream The stream we read from
   */
  QDataStream &operator>>(QDataStream &stream, BundleSolutionInfo &bundleSolutionInfo) {
    return bundleSolutionInfo.read(stream);
  }

}
Loading