Commit 9ddccab7 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Save the Control in addition to the control net. Use Control's write method...

Save the Control in addition to the control net. Use Control's write method instead of directly writing the control net.  This is done so that Control can maintain the modification state of the control net.
parent de4f06f7
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -585,6 +585,7 @@ namespace Isis {
  */
  void ControlPointEditWidget::setControl(Control *control) {
    //  TODO  more error checking
    m_control = control;
    m_controlNet = control->controlNet();
    m_cnetFileName = control->fileName();

@@ -604,8 +605,9 @@ namespace Isis {
  void ControlPointEditWidget::setControlFromActive() {

    if (m_directory->project()->activeControl()) {
      m_controlNet = m_directory->project()->activeControl()->controlNet();
      m_cnetFileName = m_directory->project()->activeControl()->fileName();
      m_control = m_directory->project()->activeControl();
      m_controlNet = m_control->controlNet();
      m_cnetFileName = m_control->fileName();

      m_cnetFileNameLabel->setText("Control Network: " + m_cnetFileName);
      setWindowTitle("Control Point Editor- Control Network File: " + m_cnetFileName);
@@ -1180,7 +1182,7 @@ namespace Isis {
          }
        }

        this->setVisible(false);
        //this->setVisible(false);
        // remove this point from the control network
        if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
                                          ControlPoint::PointLocked) {
@@ -1189,8 +1191,8 @@ namespace Isis {
          return;
        }
        if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
          delete m_editPoint;
          m_editPoint = NULL;
//        delete m_editPoint;
//        m_editPoint = NULL;
        }
      }

@@ -1244,7 +1246,10 @@ namespace Isis {
      }

      // emit a signal to alert user to save when exiting
      qDebug()<<"ControlPointEditWidget before cnetModified signal";
      emit cnetModified();
      qDebug()<<"ControlPointEditWidget after cnetModified signal";
      emit saveControlNet();

      if (m_editPoint != NULL) {
        //  Change Save Point button text to red
@@ -2511,7 +2516,7 @@ namespace Isis {
  */
  void ControlPointEditWidget::saveNet() {

    m_controlNet->Write(m_cnetFileName);
    m_control->write();

    //  Change Save Measure button text back to default
    m_saveNet->setPalette(m_saveDefaultPalette);
@@ -2521,6 +2526,7 @@ namespace Isis {


  /** 
   * This was used when ipce used docked widgets. 
   * This method is called from the constructor so that when the
   * Main window is created, it know's it's size and location.
   *
+13 −7
Original line number Diff line number Diff line
@@ -78,9 +78,13 @@ namespace Isis {
   *                           Fixes #4984.
   *   @history 2017-08-15 Tracie Sucharski - When ControlPoint is deleted, set the visibility of
   *                           this widget to false, then to true in loadPoint().  Fixes #5073.
   *   @history 2018-03-23 Tracie Sucharski - Update the cnet filename with current cnet.
   *   @history 2018-03-26 Tracie Sucharski - Update editor if a new active control net is set in
   *                            ipce. References #4567.
   *   @history 2018-03-23 Tracie Sucharski - Update the cnet filename with current cnet when it is
   *                           changed.
   *   @history 2018-03-26 Tracie Sucharski - Added slot, setControlFromActive which update editor
   *                           if a new active control net is set in ipce. References #4567.
   *   @history 2018-03-30 Tracie Sucharski - Save Control in addition to the control net and use
   *                           Control to write the control net so Control can keep track of the
   *                           modification state of the control net.
   */
  class ControlPointEditWidget : public QWidget {
    Q_OBJECT
@@ -102,6 +106,7 @@ namespace Isis {
      void newControlNetwork(ControlNet *);
      void stretchChipViewport(Stretch *, CubeViewport *);
      void measureChanged();
      // temporary signal for quick & dirty autosave in Ipce
      void saveControlNet();

    public slots:
@@ -239,6 +244,7 @@ namespace Isis {
      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<Control> m_control;          //!< Current Control

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