Commit 16292cbd authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Added ControlMeasureEditWidget and ControlPointEditWidget classes from IPCE...

Added ControlMeasureEditWidget and ControlPointEditWidget classes from IPCE (r6871) to trunk. Fixes #4062, #4004.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6876 41f8697f-d340-4b68-9986-7bafba869bb8
parent fcc04a6c
Loading
Loading
Loading
Loading
+1585 −0

File added.

Preview size limit exceeded, changes collapsed.

+260 −0
Original line number Diff line number Diff line
#ifndef ControlMeasureEditWidget_h
#define ControlMeasureEditWidget_h

// This is the only include allowed in this file!
#include <QWidget>


class QCheckBox;
class QDial;
class QDoubleSpinBox;
class QHBoxLayout;
class QLabel;
class QLCDNumber;
class QPalette;
class QPushButton;
class QRadioButton;
class QScrollBar;
class QString;
class QTimer;
class QToolButton;
class QVBoxLayout;

namespace Isis {
  class AutoReg;
  class Chip;
  class ChipViewport;
  class ControlMeasure;
  class ControlNet;
  class Cube;
  class CubeViewport;
  class Stretch;
  class Tool;
  class UniversalGroundMap;

  /**
    * @brief Point Editor Widget
    *
    * @ingroup Visualization Tools
    *
    * @author 2008-09-09 Tracie Sucharski
    *
    * @internal
    *   @history 2008-11-19 Tracie Sucharski - Addition option to
    *                          constructor to allow mouse events
    *                          on leftChipViewport.
    *   @history 2008-11-24 Tracie Sucharski - Changed class name
    *                          from PointEdit
    *   @history 2008-12-02 Jeannie Walldren - Modified
    *                          createPointEditor() to allow the
    *                          leftChipViewport to refresh even if
    *                          allowLeftMouse = false.
    *   @history 2008-12-10 Jeannie Walldren - Added a private
    *                          variable for the template filename.
    *                          Set the default value of this
    *                          variable to the previously
    *                          hard-coded template filename. Added
    *                          setTemplateFile() method derived
    *                          from previously unused and
    *                          commented out method called
    *                          openTemplateFile().
    *   @history 2008-12-15 Jeannie Walldren - Some QMessageBox
    *                          warnings had strings tacked on to
    *                          the list of errors.  These strings
    *                          were changed to iExceptions and
    *                          added to the error stack to conform
    *                          with Isis standards.
    *   @history 2008-12-30 Jeannie Walldren - Modified
    *                          savePoint() method to update user
    *                          (chooser) name and date when point
    *                          is saved
    *   @history 2009-03-17 Tracie Sucharski - Add slot to set a
    *                          boolean to indicate whether the
    *                          registration chips should be saved.
    *   @history 2010-06-08 Jeannie Walldren - Added warning box
    *                          in registerPoint() if unable to
    *                          load left or right chip
    *   @history 2010-06-26 Eric Hyer - now uses MdiCubeViewport instead of
    *                          CubeViewport.  Fixed multiple include problems.
    *   @history 2010-11-17 Eric Hyer - now forwards new ControlNets to the
    *                          ChipViewports
    *   @history 2010-11-19 Tracie Sucharski - Renamed the "Save Point" button
    *                           to "Save Measure" along with signals and slots.
    *                           Add a new "Save Point" button which actually
    *                           saves the edit point to the network.
    *   @history 2010-11-22 Eric Hyer - Forwarded SIGNAL from StretchTool to
    *                          ChipViewports
    *   @history 2010-12-01 Eric Hyer - Added checkboxes for stretch locking
    *   @history 2010-12-08 Eric Hyer - Relocated stretch locking checkboxes
    *   @history 2010-12-14 Eric Hyer - setTemplateFile now takes the filename
    *                          as a parameter (no more open dialog!)
    *   @history 2011-05-04 Jai Rideout - updated saveChips() to reference new
    *                          AutoReg API for accessing chips used in
    *                          registration.
    *   @history 2011-06-14 Tracie Sucharski - Added slot to colorize the
    *                          Save Measure button.  If user moved the tack
    *                          point, the button text will be changed to red.
    *                          If they push the save button, button will go back
    *                          to black.
    *   @history 2011-06-15 Tracie Sucharski - Changed signal mouseClick
    *                          to userMovedTackPoint.  TODO:  Could not use
    *                          tackPointChanged signal because that signal is
    *                          emitted whenever the measure is loaded not just
    *                          when the user initiates the move.  This should be
    *                          cleaned up.
    *   @history 2012-04-17  Tracie Sucharski - If geom is turned on update the
    *                          right measure in ::setLeftMeasure.
    *   @history 2012-05-01  Tracie Sucharski - Fix intereface between No Geom, geom
    *                          and rotate.  Make sure resets are done properly when
    *                          switching beween the options.
    *   @history 2012-05-07  Tracie Sucharski - Change made on 2012-04-17 introduced bug when
    *                          loading a different control point, so in setLeftMeasure, only
    *                          update the right chip if we're not loading a
    *                          different control point.
    *   @history 2012-06-28  Tracie Sucharski - Add parameter to constructor to indicate
    *                          whether to use cube geometry.  This allow cubes with no camera
    *                          or SPICE information to be used.
    *   @history 2012-07-20  Tracie Sucharski - Change the Save Measure button text and tootip
    *                          depending on whether movement is allowed on the left chip.
    *   @history 2012-07-26 Tracie Sucharski - Added ability to link zooming between left and
    *                          right viewports. Added 2 methods, zoomFactor() which returns a
    *                          zoom factor and zoom(double zoomFactor).
    *   @history 2013-04-30 Tracie Sucharski - Fixed bug introduced by linking zooms between left
    *                          and right viewports.  Zoom factors were being passed into the
    *                          Chip::Load method as the second argument which should be the rotation
    *                          value.
    *   @history 2013-11-07 Tracie Sucharski - Moved error checking on edit locked measures from
    *                          QnetTool::measureSaved to ::saveMeasure.  The error checking now
    *                          forces the edit lock check box to be unchecked before the measure
    *                          can be saved.  Fixes #1624.
    *   @history 2013-12-30 Kimberly Oyama and Stuart Sides - In saveChips(), added single quotes
    *                           around the file names in case there are spaces or other special
    *                           characters in them. Fixes #1551.
    *   @history 2014-07-03 Tracie Sucharski - Renamed from ControlPointEdit. 
    *
    *   @history 2016-06-27 Ian Humphrey - Updated documentation and coding standards. Fixes #4004.
    *  
    *   @todo  Re-think design of the change made on 2012-07-26.  The linking was put into
    *                          ::updateLeftPositionLabel because it was the fastest solution, but
    *                          should this be put somewhere else.
    */
  class ControlMeasureEditWidget : public QWidget {
      Q_OBJECT

    public:
      ControlMeasureEditWidget(QWidget *parent = 0, bool allowLeftMouse = false,
                               bool useGeometry = true);
      ~ControlMeasureEditWidget();
      /**
       * Returns the template filename used for auto-registration.
       * 
       * @return @b QString Template filename
       */
      QString templateFileName() {
        return m_templateFileName;
      };
      bool setTemplateFile(QString);
      void allowLeftMouse(bool allowMouse);

    signals:
      void updateLeftView(double sample, double line);
      void updateRightView(double sample, double line);
      void measureSaved();
      void newControlNetwork(ControlNet *);
      void stretchChipViewport(Stretch *, CubeViewport *);

    public slots:
      void setLeftMeasure(ControlMeasure *leftMeasure,
                          Cube *leftCube, QString pointId);
      void setRightMeasure(ControlMeasure *rightMeasure,
                           Cube *rightCube, QString pointId);
      void colorizeSaveButton();
      void refreshChips();
      void saveChips();

    protected slots:

    private slots:

      void setNoGeom();
      void setGeom();
      void setRotate();
      void setCircle(bool);
      void setZoomLink(bool);

      void findPoint();
      void registerPoint();
      void saveMeasure();
      void updateLeftPositionLabel(double zoomFactor);
      void updateRightGeom();
      void updateRightPositionLabel(double zoomFactor);

      void blinkStart();
      void blinkStop();
      void changeBlinkTime(double interval);
      void updateBlink();

    private:
      void createMeasureEditor(QWidget *parent);

      bool m_allowLeftMouse; //!< Whether or not to allow mouse events on left chip viewport
      bool m_useGeometry;    //!< Whether or not to allow geometry/rotation on right chip viewport

      QString m_templateFileName;      //!< Registration template filename
      QLabel *m_leftZoomFactor;        //!< Label for left chip viewport's zoom factor
      QLabel *m_rightZoomFactor;       //!< Label for right chip viewport's zoom factor
      QLabel *m_leftSampLinePosition;  //!< Label for left chip viewport's current sample/line
      QLabel *m_rightSampLinePosition; //!< Label for right chip viewport's current sample/line
      QLabel *m_leftLatLonPosition;    //!< Label for left chip viewport's current lat/lon
      QLabel *m_rightLatLonPosition;   //!< Label for right chip viewport's current lat/lon
      QRadioButton *m_nogeom; //!< Radio button to remove geometry/rotation for right chip viewport
      QRadioButton *m_geom; //!< Radio button to apply geometry/rotation to right chip viewport
      QToolButton *m_rightZoomIn;      //!< Button for zooming in right chip viewport 
      QToolButton *m_rightZoomOut;     //!< Button for zooming out right chip viewport
      QToolButton *m_rightZoom1;       //!< Button for 1:1 zoom on right chip viewport


      bool m_timerOn;  //!< Indicates if the blink timer is on
      QTimer *m_timer; //!< Timer on the blinking
      std::vector<ChipViewport *> m_blinkList; //!< List of chip viewports to blink
      unsigned char m_blinkIndex; //!< Index of the chip to load in the left chip viewport

      QDial *m_dial;                  //!< Rotation dial 
      QLCDNumber *m_dialNumber;       //!< The current amount of rotation (in degrees)
      QDoubleSpinBox *m_blinkTimeBox; //!< The current blink step (in seconds)

      bool m_circle;        //!< Whether or not to draw circle in center of the right chip viewport
      QScrollBar *m_slider; //!< Slider that controls the size of the center circle

      QPushButton *m_autoReg;      //!< Button to auto-register the measure
      QWidget *m_autoRegExtension; //!< Widget that shows after registering a measure
      QLabel *m_oldPosition;       //!< The old sample and line before registering
      QLabel *m_goodFit;           //!< The goodness of fit value after registering
      bool m_autoRegShown;         //!< Whether or not the auto-reg extension is shown
      bool m_autoRegAttempted;     //!< Whether or not auto-registration has been attempted

      QPushButton *m_saveMeasure;    //!< Button to save the current measure
      QPalette m_saveDefaultPalette; //!< Default color palette for the Save button 

      ChipViewport *m_leftView;  //!< Left ChipViewport 
      ChipViewport *m_rightView; //!< Right ChipViewport 

      Cube *m_leftCube;  //!< Left chip viewport's Cube
      Cube *m_rightCube; //!< Right chip viewport's Cube
      ControlMeasure *m_leftMeasure;  //!< Left ControlMeasure
      ControlMeasure *m_rightMeasure; //!< Right ControlMeasure
      Chip *m_leftChip;  //!< Left Chip
      Chip *m_rightChip; //!< Right Chip
      UniversalGroundMap *m_leftGroundMap;  //!< UniversalGroundMap for left cube
      UniversalGroundMap *m_rightGroundMap; //!< UniversalGroundMap for right cube

      AutoReg *m_autoRegFact; //!< Created AutoReg
      QString m_pointId;      //!< Associated control point id of the right measure

      int m_rotation;  //!< Amount to rotate right chip viewport TODO Is this used??
      bool m_geomIt;   //!< Apply geometry to the right chip viewport
      bool m_linkZoom; //!< Link zoom factors between chip viewports 
  };
};

#endif
+7 −0
Original line number Diff line number Diff line
ifeq ($(ISISROOT), $(BLANK))
.SILENT:
error:
	echo "Please set ISISROOT";
else
	include $(ISISROOT)/make/isismake.objs
endif
 No newline at end of file
+2627 −0

File added.

Preview size limit exceeded, changes collapsed.

+249 −0
Original line number Diff line number Diff line
#ifndef ControlPointEditWidget_h
#define ControlPointEditWidget_h


#include "ControlPoint.h"

#include <QPalette>
#include <QPointer>
#include <QString>
#include <QStringList>
#include <QWidget>

class QAction;
class QCheckBox;
class QComboBox;
class QGroupBox;
class QLabel;
class QMainWindow;
class QObject;
class QPushButton;
class QSplitter;
class QTableWidget;
class QTextEdit;

namespace Isis {
  class ControlMeasureEditWidget;
  class ControlMeasure;
  class ControlNet;
  class Cube;
  class CubeViewport;
  class MdiCubeViewport;
  class SerialNumberList;
  class Stretch;
  class ToolPad;
  class UniversalGroundMap;

  /**
   * @brief Gui for editing ControlPoint
   *
   * @ingroup Visualization Tools
   *
   * @author 2014-06-25 Tracie Sucharski
   *
   * @internal 
   *   @history 2016-06-27 Ian Humphrey - Updated documentation and coding standards. Fixes #4004.
   */
  class ControlPointEditWidget : public QWidget {
    Q_OBJECT

    public:
      ControlPointEditWidget(QWidget *parent, bool addMeasures = false);
      virtual ~ControlPointEditWidget();

      //! Measure column values for the measure table
      enum MeasureColumns{
        FILENAME,
        CUBESN,
        SAMPLE,
        LINE,
        APRIORISAMPLE,
        APRIORILINE,
        SAMPLERESIDUAL,
        LINERESIDUAL,
        RESIDUALMAGNITUDE,
        SAMPLESHIFT,
        LINESHIFT,
        PIXELSHIFT,
        GOODNESSOFFIT,
        IGNORED,
        EDITLOCK,
        TYPE
      };
      //! Number of entries (columns) in the measure table
      static const int NUMCOLUMNS = 16;

      QString measureColumnToString(MeasureColumns column);


    signals:
      void controlPointChanged(QString pointId);
      void controlPointAdded(QString pointId);
      void ignorePointChanged();
      void ignoreLeftChanged();
      void ignoreRightChanged();
      void netChanged();
      void newControlNetwork(ControlNet *);
      void stretchChipViewport(Stretch *, CubeViewport *);
      void measureChanged();
      void saveControlNet();

    public slots:
      void setSerialNumberList(SerialNumberList *snList);
      void setControlNet(ControlNet *cnet, QString cnetFilename);
      void setEditPoint(ControlPoint *controlPoint);

      void updatePointInfo(ControlPoint &updatedPoint);
//    void refresh();

    protected:
      bool eventFilter(QObject *o,QEvent *e);

    private slots:
//    void enterWhatsThisMode();
      void saveNet();
//    void saveAsNet();
//    void addMeasure();
//    void setPointType (int pointType);
      void setLockPoint (bool ignore);
      void setIgnorePoint (bool ignore);
      void setLockLeftMeasure (bool ignore);
      void setIgnoreLeftMeasure (bool ignore);
      void setLockRightMeasure (bool ignore);
      void setIgnoreRightMeasure (bool ignore);
//    void updateSurfacePointInfo ();

      void selectLeftMeasure (int index);
      void selectRightMeasure (int index);
      void updateLeftMeasureInfo ();
      void updateRightMeasureInfo ();
      void updateSurfacePointInfo ();

      void measureSaved();
      void checkReference();
      void savePoint();
      void colorizeSavePointButton();

      void openTemplateFile();
      void viewTemplateFile();
      void saveChips();
      void showHideTemplateEditor();
      void saveTemplateFile();
      void saveTemplateFileAs();
      void setTemplateModified();
      void writeTemplateFile(QString);
      void clearEditPoint();

      void colorizeSaveNetButton();

    private:
      void createActions();

      void loadPoint();
      void loadMeasureTable();
      void createPointEditor(QWidget *parent, bool addMeasures);
      QSplitter * createTopSplitter();
      QGroupBox * createControlPointGroupBox();
      QGroupBox * createLeftMeasureGroupBox();
      QGroupBox * createRightMeasureGroupBox();
      void createTemplateEditorWidget();
      void loadTemplateFile(QString);
      bool okToContinue();
      bool IsMeasureLocked(QString serialNumber);
      bool validateMeasureChange(ControlMeasure *m);



    private:

      QPointer<QWidget> m_parent; //!< Parent widget
      bool m_addMeasuresButton;   //!< Indicates whether or not to add "Add Measures(s) to Point"

      QString m_cnetFileName; //!< Filename of the control network that is being modified
      QPointer<QLabel> m_cnetFileNameLabel; //!< Label with name of the control network file
      bool m_netChanged; //!< Indicates if the control network has been modified

      QPointer<QAction> m_closePointEditor; //!< Action to close the point editor

      QPointer<QAction> m_saveChips; //!< Action to save the registration chips
      //! Action to toggle visibility of the registration template editor
      QPointer<QAction> m_showHideTemplateEditor;
      QPointer<QAction> m_openTemplateFile; //!< Action to open a registration template file to disk
      QPointer<QAction> m_saveTemplateFile; //!< Action to save a registration template file to disk
      QPointer<QAction> m_saveTemplateFileAs; //!< Action to save a new registration template

      //! Pointer to control measure editor widget
      QPointer<ControlMeasureEditWidget> m_measureEditor;

      QPointer<QPushButton> m_savePoint; //!< Button to save current point being edited
      QPalette m_saveDefaultPalette; //!< Default color pallet of the "Save Point" button

      QPointer<QPushButton> m_saveNet; //!< Button to save the current control network

      QPointer<QTextEdit> m_templateEditor; //!< Text editor for editing the registration template
      QPointer<QWidget> m_templateEditorWidget; //!< Template editor widget
      bool m_templateModified; //!< Indicates if the registration template was edited

      QPointer<QLabel> m_templateFileNameLabel; //!< Label for the template filename
      QPointer<QLabel> m_ptIdValue; //!< Label for the point id of the current point
      QPointer<QComboBox> m_pointType; //!< Combobox to change the type of the current point
      QPointer<QLabel> m_numMeasures; //!< Label for number of measures in the current point
      QPointer<QLabel> m_pointAprioriLatitude; //!< Label for current point's apriori latitude
      QPointer<QLabel> m_pointAprioriLongitude; //!< Label for current point's apriori longitude
      QPointer<QLabel> m_pointAprioriRadius; //!< Label for current point's apriori radius
      //! Label for current point's apriori latitude radius sigma
      QPointer<QLabel> m_pointAprioriLatitudeSigma;
      //! Label for current point's apriori longitude sigma
      QPointer<QLabel> m_pointAprioriLongitudeSigma;
      //! Label for current point's apriori radius sigma
      QPointer<QLabel> m_pointAprioriRadiusSigma;
      QPointer<QLabel> m_pointLatitude; //!< Label for current point's latitude
      QPointer<QLabel> m_pointLongitude; //!< Label for current point's longitude
      QPointer<QLabel> m_pointRadius; //!< Label for current point's radius
      
      QPointer<QCheckBox> m_lockPoint; //!< Checkbox that locks/unlocks the current point
      QPointer<QCheckBox> m_ignorePoint; //!< Checkbox to ignore the current point
      QPointer<QLabel> m_leftReference; //!< Label indicating if left measure is the reference
      QPointer<QLabel> m_leftMeasureType; //!< Label for the left measure's adjustment type
      QPointer<QLabel> m_leftSampError; //!< Label for left measure's sample residual
      QPointer<QLabel> m_leftLineError; //!< Label for left measure's line residual
      QPointer<QLabel> m_leftSampShift; //!< Label for left measure's sample shift
      QPointer<QLabel> m_leftLineShift; //!< Label for left measure's line shift
      QPointer<QLabel> m_leftGoodness;  //!< Label for left measure's goodness of fit
      QPointer<QLabel> m_rightGoodness; //!< Label for right measure's goodness of fit
      QPointer<QLabel> m_rightReference; //!< Label indicating if right measure is the reference
      QPointer<QLabel> m_rightMeasureType; //!< Label for the right measure's adjustment type
      QPointer<QLabel> m_rightSampError; //!< Label for right measure's sample residual
      QPointer<QLabel> m_rightLineError; //!< Label for right measure's line residual
      QPointer<QLabel> m_rightSampShift; //!< Label for right measure's sample shift
      QPointer<QLabel> m_rightLineShift; //!< Label for right measure's line shift
      QPointer<QCheckBox> m_lockLeftMeasure; //!< Checkbox to edit lock/unlock the left measure
      QPointer<QCheckBox> m_ignoreLeftMeasure; //!< Checkbox to ignore the left measure
      QPointer<QCheckBox> m_lockRightMeasure; //!< Checkbox to edit lock/unlock the right measure
      QPointer<QCheckBox> m_ignoreRightMeasure; //!< Checkbox to ignore the right measure

      QPointer<QComboBox> m_leftCombo; //!< Combobox to load left measure into left chip viewport
      QPointer<QComboBox> m_rightCombo; //!< Combobox to load right measure into right chip viewport

      QPointer<QMainWindow> m_measureWindow; //!< Main window for the the measure table widget
      QPointer<QTableWidget> m_measureTable; //!< Table widget for the measures

      QPointer<ControlPoint> m_editPoint; //!< The control point being edited
      SerialNumberList *m_serialNumberList; //!< Serial number list for the loaded cubes
      QPointer<ControlNet> m_controlNet; //!< Current control net

//    QPointer<NewPointDialog> m_newPointDialog;
      QPointer<ControlPoint> m_newPoint; //!< New control point
      QString m_lastUsedPointId; //!< Point id of the last used control point

      QStringList m_pointFiles; //!< Associated files for current control point

      QString m_leftFile; //<! Filename of left measure
      QPointer<ControlMeasure> m_leftMeasure; //!< Left control measure
      QPointer<ControlMeasure> m_rightMeasure; //!< Right control measure
      QScopedPointer<Cube> m_leftCube; //!< Left cube
      QScopedPointer<Cube> m_rightCube; //!< Right cube

  };
};
#endif
Loading