Commit 64ac227b authored by Ken Edmundson's avatar Ken Edmundson
Browse files

added preliminary target body functionality to ipce

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6347 41f8697f-d340-4b68-9986-7bafba869bb8
parent f9ce135b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3846,8 +3846,12 @@ namespace Isis {

        // only update point every 100 points
        if (j%100 == 0) {
            printf("\rError Propagation: Inverse Block %8d of %8d; Point %8d of %8d", 
                   i+1, nBlockColumns,  j+1, nObjectPoints);
            printf("\rError Propagation: Inverse Block %8d of %8d; Point %8d of %8d", i+1,
                   nBlockColumns,  j+1, nObjectPoints);
//          str = QString("Inverse Block %1 of %2; Point %3 of %4").arg(i+1).arg(nBlockColumns)
//              .arg(j+1).arg(nObjectPoints);

            emit iterationUpdate(i+1, j+1);
        }

        // get corresponding Q matrix
+1731 −0

File added.

Preview size limit exceeded, changes collapsed.

+196 −0
Original line number Diff line number Diff line
#ifndef BundleTargetBody_h
#define BundleTargetBody_h
/**
 * @file
 * $Revision: 1.20 $
 * $Date: 2015/5/15 08:00:00 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy & Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */

#include <QObject>
#include <QSharedPointer>
#include <QStringList>

#include <boost/numeric/ublas/vector.hpp>

#include "set"

#include "Angle.h"
#include "Distance.h"
#include "Latitude.h"
#include "Longitude.h"

namespace Isis {

  class BundleSettings;
  class PvlObject;
  class Target;

  /**
   * @brief 
   *  
   * @ingroup ControlNetworks
   *
   * @author 2015-05-15 Ken Edmundson
   *
   * @internal
   *   @history 2015-05-15 Ken Edmundson - version 1.
   *
   */
  class BundleTargetBody : public QObject {

    Q_OBJECT

    public:
      // constructors
      BundleTargetBody();                            // default
      BundleTargetBody(Target *target);
      //BundleTargetBody(const BundleTargetBody &src); // copy
      ~BundleTargetBody();

      // copy (move to private????)
      //BundleTargetBody &operator=(const BundleTargetBody &src);
      //void copy(const BundleTargetBody &src);

      enum TargetRadiiSolveMethod {
        None = 0,                  //!< none
        Mean = 1,                  //!< mean radius
        All  = 2                   //!< all radii
      };

      enum TargetSolveCodes { PoleRA              = 0,
                              VelocityPoleRA      = 1,
                              AccelerationPoleRA  = 2,
                              PoleDec             = 3,
                              VelocityPoleDec     = 4,
                              AccelerationPoleDec = 5,
                              PM                  = 6,
                              VelocityPM          = 7,
                              AccelerationPM      = 8,
                              TriaxialRadiusA     = 9,
                              TriaxialRadiusB     = 10,
                              TriaxialRadiusC     = 11,
                              MeanRadius          = 12
                            };

      void setSolveSettings(std::set<int> targetParameterSolveCodes,
                            Angle aprioriPoleRA, Angle sigmaPoleRA, Angle aprioriVelocityPoleRA,
                            Angle sigmaVelocityPoleRA, Angle aprioriPoleDec, Angle sigmaPoleDec,
                            Angle aprioriVelocityPoleDec, Angle sigmaVelocityPoleDec,
                            Angle aprioriPM, Angle sigmaPM, Angle aprioriVelocityPM,
                            Angle sigmaVelocityPM, TargetRadiiSolveMethod solveRadiiMethod,
                            Distance aprioriRadiusA, Distance sigmaRadiusA, Distance aprioriRadiusB,
                            Distance sigmaRadiusB, Distance aprioriRadiusC, Distance sigmaRadiusC,
                            Distance aprioriMeanRadius, Distance sigmaMeanRadius);

      static TargetRadiiSolveMethod stringToTargetRadiiOption(QString option);
      static QString targetRadiiOptionToString(TargetRadiiSolveMethod targetRadiiSolveMethod);

      bool readFromPvl(PvlObject &tbPvlObject);

      // mutators
      //

      // accessors
      boost::numeric::ublas::vector<double> &parameterWeights();
      boost::numeric::ublas::vector<double> &parameterCorrections();
      boost::numeric::ublas::vector<double> &parameterSolution();
      boost::numeric::ublas::vector<double> &aprioriSigmas();
      boost::numeric::ublas::vector<double> &adjustedSigmas();

      std::vector<Angle> poleRaCoefs();
      std::vector<Angle> poleDecCoefs();
      std::vector<Angle> pmCoefs();

      std::vector<Distance> radii();
      Distance meanRadius();

      // string format methods
      // TODO implement
      QString formatBundleOutputString(bool errorPropagation);
      QStringList parameterList();
      QString formatValue(double value, int fieldWidth, int precision) const;
      QString formatAprioriSigmaString(int type, int fieldWidth, int precision) const;
      QString formatPolePositionAprioriSigmaString(int fieldWidth, int precision) const;
      QString formatW0AprioriSigmaString(int fieldWidth, int precision) const;
      QString formatWDotAprioriSigmaString(int fieldWidth, int precision) const;
      QString formatRadiusAprioriSigmaString(int fieldWidth, int precision) const;
      QString formatPolePositionAdjustedSigmaString(int fieldWidth, int precision) const;
      QString formatW0AdjustedSigmaString(int fieldWidth, int precision) const;
      QString formatWDotAdjustedSigmaString(int fieldWidth, int precision) const;
      QString formatRadiusAdjustedSigmaString(int fieldWidth, int precision) const;

      bool solvePoleRA();
      bool solvePoleRAVelocity();
      bool solvePoleRAAcceleration();
      bool solvePoleDec();
      bool solvePoleDecVelocity();
      bool solvePoleDecAcceleration();
      bool solvePM();
      bool solvePMVelocity();
      bool solvePMAcceleration();
      bool solveTriaxialRadii();
      bool solveMeanRadius();

//      int numberPoleParameters();
//      int numberW0Parameters();
//      int numberWDotParameters();
      int numberRadiusParameters();
      int numberParameters();

      void applyParameterCorrections(boost::numeric::ublas::vector<double> corrections);

      double vtpv();

      Distance localRadius(const Latitude &lat, const Longitude &lon);

    private:
      TargetRadiiSolveMethod m_solveTargetBodyRadiusMethod;
      Distance m_aprioriRadiusA;
      Distance m_sigmaRadiusA;
      Distance m_aprioriRadiusB;
      Distance m_sigmaRadiusB;
      Distance m_aprioriRadiusC;
      Distance m_sigmaRadiusC;
      Distance m_aprioriMeanRadius;
      Distance m_sigmaMeanRadius;

      std::vector<Distance> m_radii;
      Distance m_meanRadius;

      std::vector<Angle> m_raPole;                   //!< pole ra quadratic polynomial coefficients
      std::vector<Angle> m_decPole;                  //!< pole dec quadratic polynomial coefficients
      std::vector<Angle> m_pm ;                      //!< pole pm quadratic polynomial coefficients

      std::set<int> m_parameterSolveCodes;  //!< target parameter solve codes (TODO: explain better)
                                            //!< ALSO, WHY DID I USE A std::set here? (there was a
                                            //!  good reason)
      QStringList m_parameterNamesList;     //!< list of all target parameters

      boost::numeric::ublas::vector<double> m_weights;         //!< parameter weights
      boost::numeric::ublas::vector<double> m_corrections;     //!< cumulative parameter corrections
      boost::numeric::ublas::vector<double> m_solution;        //!< parameter solution vector
      boost::numeric::ublas::vector<double> m_aprioriSigmas;   //!< a priori parameter sigmas
      boost::numeric::ublas::vector<double> m_adjustedSigmas;  //!< adjusted parameter sigmas
  };

  typedef QSharedPointer<BundleTargetBody> BundleTargetBodyQsp;
}

#endif // BundleTargetBody_h
+111 −0
Original line number Diff line number Diff line
/**
 * @file
 * $Revision: 1.19 $
 * $Date: 2010/03/22 19:44:53 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */
#include "SensorGetInfoWorkOrder.h"

#include <QtDebug>

#include <QFileDialog>
#include <QInputDialog>

#include "Directory.h"
#include "IException.h"
#include "Project.h"
#include "GuiCamera.h"
#include "SensorInfoWidget.h"

namespace Isis {

  SensorGetInfoWorkOrder::SensorGetInfoWorkOrder(Project *project) :
      WorkOrder(project) {
    QAction::setText(tr("Get Info..."));
  }


  SensorGetInfoWorkOrder::SensorGetInfoWorkOrder(const SensorGetInfoWorkOrder &other) :
      WorkOrder(other) {
  }


  SensorGetInfoWorkOrder::~SensorGetInfoWorkOrder() {
  }


  SensorGetInfoWorkOrder *SensorGetInfoWorkOrder::clone() const {
    return new SensorGetInfoWorkOrder(*this);
  }


  bool SensorGetInfoWorkOrder::isExecutable(GuiCamera *guiCamera) {
    if (!guiCamera)
      return false;

    // if we already have a view for this camera, don't redisplay
    QList<SensorInfoWidget *> existingViews = project()->directory()->sensorInfoViews();
    for (int i = 0; i < existingViews.size(); i++) {
      if (existingViews.at(i)->objectName() == guiCamera->displayProperties()->displayName())
        return false;
    }

    return true;
  }


  bool SensorGetInfoWorkOrder::execute() {
    bool success = WorkOrder::execute();

    if (success) {
      QString sensorDisplayName = guiCamera()->displayProperties()->displayName();
      QUndoCommand::setText(tr("Get %1 sensor info").arg(sensorDisplayName));

      QStringList internalData;
      internalData.append(sensorDisplayName);
      setInternalData(internalData);
    }

    return success;
  }


  bool SensorGetInfoWorkOrder::dependsOn(WorkOrder *other) const {
    // depend on types of ourselves.
    return dynamic_cast<SensorGetInfoWorkOrder *>(other);
  }


  void SensorGetInfoWorkOrder::syncRedo() {
    SensorInfoWidget *sensorInfoWidget =
        project()->directory()->addSensorInfoView(guiCamera());


    if (!sensorInfoWidget) {
      QString msg = "error displaying sensor info";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
  }


  void SensorGetInfoWorkOrder::syncUndo() {
    //delete project()->directory()->cnetEditorViews().last();
  }
}
+60 −0
Original line number Diff line number Diff line
#ifndef SensorGetInfoWorkOrder_H
#define SensorGetInfoWorkOrder_H
/**
 * @file
 * $Revision: 1.19 $
 * $Date: 2010/03/22 19:44:53 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */
#include "WorkOrder.h"

namespace Isis {
  class GuiCamera;

  /**
   * This work order allows the user to view target body info.
   *
   * @author 2015-07-10 Ken Edmundson
   *
   * @internal
   */

  class SensorGetInfoWorkOrder : public WorkOrder {
      Q_OBJECT
    public:
      SensorGetInfoWorkOrder(Project *project);
      SensorGetInfoWorkOrder(const SensorGetInfoWorkOrder &other);
      ~SensorGetInfoWorkOrder();

      virtual SensorGetInfoWorkOrder *clone() const;

      virtual bool isExecutable(GuiCamera *camera);
      bool execute();

    protected:
      bool dependsOn(WorkOrder *other) const;
      void syncRedo();
      void syncUndo();

    private:
      SensorGetInfoWorkOrder &operator=(const SensorGetInfoWorkOrder &rhs);
  };
}
#endif
Loading