Commit baa78dbe authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Updated documentation and coding standards for ChipViewport. Fixes #3958.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6779 41f8697f-d340-4b68-9986-7bafba869bb8
parent 33db2050
Loading
Loading
Loading
Loading
+266 −187
Original line number Diff line number Diff line
@@ -17,76 +17,85 @@

namespace Isis {

  //!  Construct an empty viewport
  ChipViewport::ChipViewport(int width, int height, QWidget *parent) :
    QWidget(parent) {
  /**
   * Construct an empty viewport
   *
   * @param width The width of the viewport
   * @param height The height of the viewport
   * @param parent The parent widget
   */
  ChipViewport::ChipViewport(int width, int height, QWidget *parent) : QWidget(parent) {

    setFixedSize(width, height);
    setBackgroundRole(QPalette::Dark);
//    setFocusPolicy(Qt::StrongFocus);

    p_width = width;
    p_height = height;
    p_zoomFactor = 1.0;
    p_rotation = 0;
    p_geomIt = false;
    p_tempView = NULL;
    p_cross = true;
    p_circle = false;
    p_chip = NULL;
    p_chipCube = NULL;
    p_matchChip = NULL;
    p_matchChipCube = NULL;
    p_image = NULL;
    p_image = new QImage(512, 512, QImage::Format_RGB32);
    p_image->fill(Qt::black);
    p_controlNet = NULL;
    p_stretchLocked = false;
    p_stretch = NULL;

    p_stretch = new Stretch;
    m_width = width;
    m_height = height;
    m_zoomFactor = 1.0;
    m_rotation = 0;
    m_geomIt = false;
    m_tempView = NULL;
    m_cross = true;
    m_circle = false;
    m_chip = NULL;
    m_chipCube = NULL;
    m_matchChip = NULL;
    m_matchChipCube = NULL;
    m_image = NULL;
    m_image = new QImage(512, 512, QImage::Format_RGB32);
    m_image->fill(Qt::black);
    m_controlNet = NULL;
    m_stretchLocked = false;
    m_stretch = NULL;

    m_stretch = new Stretch;
  }


  /**
   * Destructor
   *
   */
  ChipViewport::~ChipViewport() {
    if (p_stretch) {
      delete p_stretch;
      p_stretch = NULL;
    if (m_stretch) {
      delete m_stretch;
      m_stretch = NULL;
    }
  }


  /**
   * get viewport x and y from cube sample and line
   * Get viewport x and y from cube sample and line
   *
   * @param samp Sample in cube
   * @param line Line in cube
   * @param x calcualated viewport x coordinate
   * @param y calcualated viewport y coordinate
   * @param x Calcualated viewport x coordinate
   * @param y Calcualated viewport y coordinate
   *
   * @returns True if the point is contained in the viewport, false otherwise
   * @return @b bool true if the point is contained in the viewport, false otherwise
   */
  bool ChipViewport::cubeToViewport(double samp, double line,
                                    int &x, int &y) {

    p_chip->SetCubePosition(samp, line);
    x = ((int) p_chip->ChipSample()) - 1;
    y = ((int) p_chip->ChipLine()) - 1;
    m_chip->SetCubePosition(samp, line);
    x = ((int) m_chip->ChipSample()) - 1;
    y = ((int) m_chip->ChipLine()) - 1;

    return p_chip->IsInsideChip(samp, line);
    return m_chip->IsInsideChip(samp, line);
  }


  /**
   * Set the chip for this ChipViewport
   *
   * @param chip Pointer to the chip to set the viewport with
   * @param chipCube Pointer to the chip's cube
   *
   * @throws IException::Programmer "Can not view NULL chip pointer"
   *
   * @author Tracie Sucharski
   * @internal
   *   @history 2009-14-2009  Tracie Sucharski - Make sure the p_image is clear
   *   @history 2009-14-2009 Tracie Sucharski - Make sure the m_image is clear
   *                             before allocating new.
   */

@@ -98,51 +107,58 @@ namespace Isis {
                       _FILEINFO_);
    }

    p_zoomFactor = 1.0;
    p_rotation = 0;
    m_zoomFactor = 1.0;
    m_rotation = 0;

    p_chip = chip;
    p_chipCube = chipCube;
    if (p_image != NULL)
      delete p_image;
    p_image = new QImage(chip->Samples(), chip->Lines(), QImage::Format_RGB32);
    m_chip = chip;
    m_chipCube = chipCube;
    if (m_image != NULL)
      delete m_image;
    m_image = new QImage(chip->Samples(), chip->Lines(), QImage::Format_RGB32);

    autoStretch();
    emit tackPointChanged(p_zoomFactor);
    emit tackPointChanged(m_zoomFactor);
  }


  //! Apply automatic stretch using data from entire chip
  /**
   * Apply automatic stretch using data from entire chip
   */
  void ChipViewport::autoStretch() {
    computeStretch(p_gray.stretch);
    computeStretch(m_gray.stretch);
    paintImage();
    update();
  }


  void ChipViewport::stretchFromCubeViewport(Stretch *newStretch,
      CubeViewport *cvp) {
  /**
   * Applies a new stretch to the specified cube viewport
   *
   * @param newStretch Pointer to the new stretch to apply
   * @param cvp Pointer to the cube viewport to apply the stretch to
   */ 
  void ChipViewport::stretchFromCubeViewport(Stretch *newStretch, CubeViewport *cvp) {

    ASSERT(cvp != NULL);

    if (!cvp || !p_chipCube)
    if (!cvp || !m_chipCube)
      return;

    // only stretch if the CubeViewport is opened to the same cube as we are,
    // otherwise the signal was meant for a different ChipViewport!
    if (cvp->cube()->fileName() == p_chipCube->fileName()) {
    if (cvp->cube()->fileName() == m_chipCube->fileName()) {

      // if user right clicked in the CubeViewport then we get a SIGNAL with a
      // NULL Stretch.  This is used to signify that we need to restretch on our
      // own (go back to global).
      if (!newStretch) {
        computeStretch(p_gray.stretch, true);
        computeStretch(m_gray.stretch, true);
        paintImage();
        update();
      }
      else {
        *p_stretch = *newStretch;
        p_gray.stretch = *newStretch;
        *m_stretch = *newStretch;
        m_gray.stretch = *newStretch;
        paintImage();
        update();
      }
@@ -150,32 +166,43 @@ namespace Isis {
  }


  /**
   * Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.)
   *  
   * @param newStatus Non-zero locks the stretch 
   */
  void ChipViewport::changeStretchLock(int newStatus) {
    if (newStatus == 0)
      p_stretchLocked = false;
      m_stretchLocked = false;
    else
      p_stretchLocked = true;
      m_stretchLocked = true;
  }


  //! Compute automatic stretch for a portion of the cube
  /**
   * Compute automatic stretch for a portion of the cube. If the stretch is locked and force is
   * false, no computations will be performed.
   *
   * @param stretch Reference to the stretch to be computed (if unlocked)
   * @param force If true, forces the stretch to be computed.
   */
  void ChipViewport::computeStretch(Stretch &stretch, bool force) {
    if (p_stretchLocked && !force) {
      stretch = *p_stretch;
    if (m_stretchLocked && !force) {
      stretch = *m_stretch;
    }
    else {
      Statistics stats;
      for (int line = 1; line < p_chip->Lines(); line++) {
        for (int samp = 1; samp < p_chip->Samples(); samp++) {
          double value = p_chip->GetValue(samp, line);
      for (int line = 1; line < m_chip->Lines(); line++) {
        for (int samp = 1; samp < m_chip->Samples(); samp++) {
          double value = m_chip->GetValue(samp, line);
          stats.AddData(&value, 1);
        }
      }

      Histogram hist(stats.BestMinimum(), stats.BestMaximum());
      for (int line = 1; line <= p_chip->Lines(); line++) {
        for (int samp = 1; samp <= p_chip->Samples(); samp++) {
          double value = p_chip->GetValue(samp, line);
      for (int line = 1; line <= m_chip->Lines(); line++) {
        for (int samp = 1; samp <= m_chip->Samples(); samp++) {
          double value = m_chip->GetValue(samp, line);
          hist.AddData(&value, 1);
        }
      }
@@ -190,20 +217,22 @@ namespace Isis {
        stretch.AddPair(DBL_MAX, 255.0);
      }

      *p_stretch = stretch;
      *m_stretch = stretch;
    }
  }


  //! Paint QImage
  /**
   * Paints the chip viewport after the chip has been updated
   */
  void ChipViewport::paintImage() {
    //  TODO: ??? Need something similar to CubeViewport clipping, so that
    //TODO ??? Need something similar to CubeViewport clipping, so that
    //         at edge of image, fill viewport w/ black
    for (int y = 0; y < p_chip->Lines(); y++) {
      QRgb *rgb = (QRgb *) p_image->scanLine(y);
    for (int y = 0; y < m_chip->Lines(); y++) {
      QRgb *rgb = (QRgb *) m_image->scanLine(y);
      int r, g, b;
      for (int x = 0; x < p_chip->Samples(); x++) {
        r = g = b = (int) p_gray.stretch.Map(p_chip->GetValue(x + 1, y + 1));
      for (int x = 0; x < m_chip->Samples(); x++) {
        r = g = b = (int) m_gray.stretch.Map(m_chip->GetValue(x + 1, y + 1));
        rgb[x] =  qRgb(r, g, b);
      }
    }
@@ -212,10 +241,11 @@ namespace Isis {
  }



  /**
   * Repaint the viewport
   *
   * @param e QPaintEvent
   *
   * @internal
   *   @history 2011-08-23 Tracie Sucharski - Use the GetMeasuresInCube method
   *                           from ControlNet to get list of measures rather
@@ -227,37 +257,37 @@ namespace Isis {

    QPainter painter(this);

    if (p_tempView != NULL) {
      painter.drawImage(0, 0, *(p_tempView->p_image));
    if (m_tempView != NULL) {
      painter.drawImage(0, 0, *(m_tempView->m_image));
    }
    else {
      painter.drawImage(0, 0, *p_image);
      painter.drawImage(0, 0, *m_image);
    }

    if (p_cross == true) {
    if (m_cross == true) {
      painter.setPen(Qt::red);
      painter.drawLine(0, (p_height - 1) / 2, p_width - 1, (p_height - 1) / 2);
      painter.drawLine((p_width - 1) / 2, 0, (p_width - 1) / 2, p_height - 1);
      painter.drawLine(0, (m_height - 1) / 2, m_width - 1, (m_height - 1) / 2);
      painter.drawLine((m_width - 1) / 2, 0, (m_width - 1) / 2, m_height - 1);
    }

    if (p_circle == true) {
    if (m_circle == true) {
      painter.setPen(Qt::red);
      painter.drawEllipse((p_height - 1) / 2 - p_circleSize / 2,
                          (p_width - 1) / 2 - p_circleSize / 2,
                          p_circleSize, p_circleSize);
      painter.drawEllipse((m_height - 1) / 2 - m_circleSize / 2,
                          (m_width - 1) / 2 - m_circleSize / 2,
                          m_circleSize, m_circleSize);
    }

    QString serialNumber = p_chipCube? SerialNumber::Compose(*p_chipCube) : QString();
    if (p_controlNet && !serialNumber.isEmpty() && p_controlNet->GetCubeSerials().contains(
                             serialNumber)) {
    QString serialNumber = m_chipCube? SerialNumber::Compose(*m_chipCube) : QString();
    if (m_controlNet && !serialNumber.isEmpty()
        && m_controlNet->GetCubeSerials().contains(serialNumber)) {
      // draw measure locations if we have a control network
      //  If the serial number is Unknown, we probably have a ground source
      //  file or level 2 which means it does not exist in the network
      //  TODO:  Is there a better way to handle this?
      if (p_showPoints && serialNumber.compare("Unknown") &&
          p_controlNet->GetNumPoints() != 0) {
      //TODO Is there a better way to handle this?
      if (m_showPoints && serialNumber.compare("Unknown") &&
          m_controlNet->GetNumPoints() != 0) {
        QList<ControlMeasure *> measures =
                                   p_controlNet->GetMeasuresInCube(serialNumber);
                                   m_controlNet->GetMeasuresInCube(serialNumber);
        // loop through all points in the control net
        for (int i = 0; i < measures.count(); i++) {
          ControlMeasure *m = measures[i];
@@ -282,7 +312,7 @@ namespace Isis {
          }

          // draw points which are not under cross
          if (x != (p_width - 1) / 2 || y != (p_height - 1) / 2) {
          if (x != (m_width - 1) / 2 || y != (m_height - 1) / 2) {
            painter.drawLine(x - 5, y, x + 5, y);
            painter.drawLine(x, y - 5, x, y + 5);
          }
@@ -290,15 +320,19 @@ namespace Isis {
      }
    }

    p_tempView = NULL;
    m_tempView = NULL;
    //painter.end();

  }


  //!  Load with info from given ChipViewport
  /**  
   * Load with info from given ChipViewport
   *
   * @param newView The chip viewport to load from
   */
  void ChipViewport::loadView(ChipViewport &newView) {
    p_tempView = &newView;
    m_tempView = &newView;
    update();
  }

@@ -306,137 +340,156 @@ namespace Isis {
  /**
   * Returns tack sample
   *
   *
   * @return double
   * @return @b double The tack sample for the chip
   */
  double ChipViewport::tackSample() {
    p_chip->SetChipPosition(p_chip->TackSample(), p_chip->TackLine());
    return p_chip->CubeSample();
    m_chip->SetChipPosition(m_chip->TackSample(), m_chip->TackLine());
    return m_chip->CubeSample();
  }


  /**
   * returns tack Line
   * Returns tack line
   *
   *
   * @return double
   * @return @b double The tack line for the chip
   */
  double ChipViewport::tackLine() {
    p_chip->SetChipPosition(p_chip->TackSample(), p_chip->TackLine());
    return p_chip->CubeLine();
    m_chip->SetChipPosition(m_chip->TackSample(), m_chip->TackLine());
    return m_chip->CubeLine();
  }


  //!<  Pan up
  /**
   * Pan up
   */
  void ChipViewport::panUp() {
    int x, y;
    x = p_chip->TackSample();
    y = p_chip->TackLine() - 1;
    x = m_chip->TackSample();
    y = m_chip->TackLine() - 1;
    //  Reload with new cube position
    p_chip->SetChipPosition((double)x, (double)y);
    reloadChip(p_chip->CubeSample(), p_chip->CubeLine());
    m_chip->SetChipPosition((double)x, (double)y);
    reloadChip(m_chip->CubeSample(), m_chip->CubeLine());
  }


  //!<  Pan down
  /**
   * Pan down
   */
  void ChipViewport::panDown() {
    int x, y;
    x = p_chip->TackSample();
    y = p_chip->TackLine() + 1;
    x = m_chip->TackSample();
    y = m_chip->TackLine() + 1;
    //  Reload with new cube position
    p_chip->SetChipPosition((double)x, (double)y);
    reloadChip(p_chip->CubeSample(), p_chip->CubeLine());
    m_chip->SetChipPosition((double)x, (double)y);
    reloadChip(m_chip->CubeSample(), m_chip->CubeLine());
  }


  //!<  Pan left
  /** 
   * Pan left
   */
  void ChipViewport::panLeft() {
    int x, y;
    x = p_chip->TackSample() - 1;
    y = p_chip->TackLine();
    x = m_chip->TackSample() - 1;
    y = m_chip->TackLine();
    //  Reload with new cube position
    p_chip->SetChipPosition((double)x, (double)y);
    reloadChip(p_chip->CubeSample(), p_chip->CubeLine());
    m_chip->SetChipPosition((double)x, (double)y);
    reloadChip(m_chip->CubeSample(), m_chip->CubeLine());
  }


  //!<  Pan right
  /**
   * Pan right
   */
  void ChipViewport::panRight() {
    int x, y;
    x = p_chip->TackSample() + 1;
    y = p_chip->TackLine();
    x = m_chip->TackSample() + 1;
    y = m_chip->TackLine();
    //  Reload with new cube position
    p_chip->SetChipPosition((double)x, (double)y);
    reloadChip(p_chip->CubeSample(), p_chip->CubeLine());
    m_chip->SetChipPosition((double)x, (double)y);
    reloadChip(m_chip->CubeSample(), m_chip->CubeLine());
  }


  /**
   * Zoom in
   *
   */
  void ChipViewport::zoomIn() {

    p_zoomFactor /= 2.0;
    m_zoomFactor /= 2.0;
    reloadChip();
  }


  /**
   * Zoom out
   *
   */
  void ChipViewport::zoomOut() {

    p_zoomFactor *= 2.0;
    m_zoomFactor *= 2.0;
    reloadChip();
  }


  /**
   * Zoom by a factor of one.
   *
   * Zoom by a factor of one
   */
  void ChipViewport::zoom1() {

    p_zoomFactor = 1.0;
    m_zoomFactor = 1.0;
    reloadChip();
  }


  /**
   * Zoom by a specified factor
   *
   * @param zoomFactor The zoom factor
   */
  void ChipViewport::zoom(double zoomFactor) {
    p_zoomFactor = zoomFactor;
    m_zoomFactor = zoomFactor;
    reloadChip();
  }



  /**
   * Returns the current zoom factor
   *
   * @return @b double The current zoom factor
   */
  double ChipViewport::zoomFactor() {
    return p_zoomFactor;
    return m_zoomFactor;
  }



  //!<  Slot to refresh viewport , point has changed
  /**
   * Slot to refresh viewport when the tack point has changed
   *
   * @param tackSample Sample on the cube to load the chip viewport at (center)
   * @param tackLine Line on the cube to load the chip viewport at (center)
   */
  void ChipViewport::refreshView(double tackSample, double tackLine) {

    reloadChip(tackSample, tackLine);

  }


  //!<  If mouse enters, make sure key events are processed w/o clicking
  /**
   * If mouse enters, make sure key events are processed w/o clicking
   *
   * @param e QEvent
   */
  void ChipViewport::enterEvent(QEvent *e) {
    setFocus();
  }


  //!< Process arrow keystrokes on cube
  /**
   * Process arrow keystrokes on cube
   *
   * @param e QKeyEvent
   */
  void ChipViewport::keyPressEvent(QKeyEvent *e) {

    int x, y;
    x = p_chip->TackSample();
    y = p_chip->TackLine();
    x = m_chip->TackSample();
    y = m_chip->TackLine();
    if (e->key() == Qt::Key_Up) {
      y--;
    }
@@ -455,16 +508,17 @@ namespace Isis {
    }

    //  Reload with new cube position
    p_chip->SetChipPosition((double)x, (double)y);
    reloadChip(p_chip->CubeSample(), p_chip->CubeLine());
    m_chip->SetChipPosition((double)x, (double)y);
    reloadChip(m_chip->CubeSample(), m_chip->CubeLine());
    emit userMovedTackPoint();
  }



  /**
   * Process mouse events
   *
   * @param event QMouseEvent
   *
   * @internal
   *   @history 2011-09-29 Tracie Sucharski - Added the setFocus call
   *                           so that arrow keys would work.
@@ -474,75 +528,96 @@ namespace Isis {
    QPoint p = event->pos();
    if (event->button() == Qt::LeftButton) {
      //  Reload with new cube position
      p_chip->SetChipPosition((double)p.x(), (double)p.y());
      reloadChip(p_chip->CubeSample(), p_chip->CubeLine());
      m_chip->SetChipPosition((double)p.x(), (double)p.y());
      reloadChip(m_chip->CubeSample(), m_chip->CubeLine());
      emit userMovedTackPoint();
      //  This was added when the scrolled area was added to the QnetTool.
      //  For some reason when clicking in the ChipViewport, focus would be
      //  lost and the arrow keys would no longer work.
      //  TODO:  Is this the correct way to fix this, why is it happening?
      //TODO  Is this the correct way to fix this, why is it happening?
      setFocus();
    }
  }


  //!<  Slot to set whether control points are drawn
  /**
   * Slot to set whether control points are drawn
   *
   * @param checked Control points are set to be drawn if true
   */
  void ChipViewport::setPoints(bool checked) {

    if (checked == p_showPoints)
    if (checked == m_showPoints)
      return;

    p_showPoints = checked;
    m_showPoints = checked;
    repaint();

  }


  //!<  Slot to change state of crosshair
  /**
   * Slot to change state of crosshair
   *
   * @param checked Crosshair set to be drawn if true
   */
  void ChipViewport::setCross(bool checked) {

    if (checked == p_cross)
    if (checked == m_cross)
      return;

    p_cross = checked;
    m_cross = checked;
    repaint();

  }


  /**
   * Slot to change state of circle
   *
   * @param checked Circle set to be drawn if true
   */
  void ChipViewport::setCircle(bool checked) {

    if (checked == p_circle)
    if (checked == m_circle)
      return;

    p_circle = checked;
    m_circle = checked;
    repaint();
  }


  /**
   * Set the size of the circle
   *
   * @param size The size of the circle
   */
  void ChipViewport::setCircleSize(int size) {

    p_circleSize = size;
    m_circleSize = size;
    repaint();

  }



  /**
   * Slot to geom chip
   * Slot to geom chip (apply geometry transformation)
   *
   * @param matchChip The matching chip for the geometry
   * @param matchChipCube The matching chip's cube for the geometry 
   * 
   * @internal
   *   @history 2010-06-16 Jeannie Walldren - Catch possible iException from Chip's
   *                           Load() method and display in QMessageBox
   */
  void ChipViewport::geomChip(Chip *matchChip, Cube *matchChipCube) {

    p_geomIt = true;
    p_matchChip = matchChip;
    p_matchChipCube = matchChipCube;
    m_geomIt = true;
    m_matchChip = matchChip;
    m_matchChipCube = matchChipCube;
    try {
      p_chip->Load(*p_chipCube, *matchChip, *matchChipCube);
//    p_chip->ReLoad(*matchChip,p_zoomFactor);
      m_chip->Load(*m_chipCube, *matchChip, *matchChipCube);
//    m_chip->ReLoad(*matchChip,m_zoomFactor);
    }
    catch (IException &e) {
      QString msg = "Cannot geom chip.\n";
@@ -551,21 +626,23 @@ namespace Isis {
      return;
    }

    //  TODO:   ??? Can these be added to paintEvent method ???
    //TODO ??? Can these be added to paintEvent method ???
    autoStretch();
  }


  /**
   * Slot to geom chip
   * Slot to un-geom chip (revert geometry transformation)
   * 
   * @internal
   *   @history 2010-06-16 Jeannie Walldren - Catch possible iException from Chip's
   *                           Load() method and display in QMessageBox
   */
  void ChipViewport::nogeomChip() {

    p_geomIt = false;
    m_geomIt = false;
    try {
      p_chip->Load(*p_chipCube, p_rotation, p_zoomFactor);
      m_chip->Load(*m_chipCube, m_rotation, m_zoomFactor);
    }
    catch (IException &e) {
      QString msg = "Cannot load no geom chip.\n";
@@ -574,7 +651,7 @@ namespace Isis {
      return;
    }

    //  TODO:   ??? Can these be added to paintEvent method ???
    //TODO ??? Can these be added to paintEvent method ???
    autoStretch();
  }

@@ -582,9 +659,8 @@ namespace Isis {
  /**
   * Slot to rotate chip
   *
   * @param rotation How much to rotate the chip
   *
   *
   * @param rotation
   * @internal
   *   @history 2010-06-16 Jeannie Walldren - Catch possible iException from Chip's
   *                           Load() method and display in QMessageBox
@@ -592,9 +668,9 @@ namespace Isis {

  void ChipViewport::rotateChip(int rotation) {

    p_rotation = -rotation;
    m_rotation = -rotation;
    try {
      p_chip->Load(*p_chipCube, -rotation, p_zoomFactor);
      m_chip->Load(*m_chipCube, -rotation, m_zoomFactor);
    }
    catch (IException &e) {
      QString msg = "Cannot load rotated chip.\n";
@@ -603,37 +679,40 @@ namespace Isis {
      return;
    }

    //  TODO:   ??? Can these be added to paintEvent method ???
    //TODO ??? Can these be added to paintEvent method ???
    autoStretch();
  }


  /**
   * Reloads the chip.
   * Reloads the chip at the given tack point on the cube
   *
   * @param tackSample Sample in the cube to load the chip on (center)
   * @param tackLine Line in the cube to load the chip on (center)
   *
   * @param tackSample
   * @param tackLine
   * @throws IException::Programmer "Can not view NULL chip pointer"
   *
   * @internal
   *   @history 2010-06-16 Jeannie Walldren - Catch possible iException from Chip's
   *                           Load() method and display in QMessageBox
   */
  void ChipViewport::reloadChip(double tackSample, double tackLine) {

    // Is the chip usable?
    if (p_chip == NULL) {
    if (m_chip == NULL) {
      throw IException(IException::Programmer,
                       "Can not view NULL chip pointer",
                       _FILEINFO_);
    }

    if (tackSample != 0. && tackLine != 0.)
      p_chip->TackCube(tackSample, tackLine);
    if (p_geomIt) {
      if (p_matchChip == NULL) {
      m_chip->TackCube(tackSample, tackLine);
    if (m_geomIt) {
      if (m_matchChip == NULL) {
        throw IException(IException::User, "Invalid match chip", _FILEINFO_);
      }
      try {
        p_chip->Load(*p_chipCube, *p_matchChip, *p_matchChipCube);
        m_chip->Load(*m_chipCube, *m_matchChip, *m_matchChipCube);
      }
      catch (IException &e) {
        QString msg = "Cannot reload chip.\n";
@@ -641,11 +720,11 @@ namespace Isis {
        QMessageBox::information((QWidget *)parent(), "Error", msg);
        return;
      }
//      p_chip->ReLoad(*p_matchChip,p_zoomFactor);
//      m_chip->ReLoad(*m_matchChip,m_zoomFactor);
    }
    else {
      try {
        p_chip->Load(*p_chipCube, p_rotation, p_zoomFactor);
        m_chip->Load(*m_chipCube, m_rotation, m_zoomFactor);
      }
      catch (IException &e) {
        QString msg = "Cannot reload chip.\n";
@@ -656,11 +735,11 @@ namespace Isis {
    }


    //  TODO:   ??? Can these be added to paintEvent method ???
    //TODO ??? Can these be added to paintEvent method ???
    autoStretch();

    //  emit signal indicating tack point changed so that the TieTool
    //  can update the sample/line label.
    emit tackPointChanged(p_zoomFactor);
    emit tackPointChanged(m_zoomFactor);
  }
}
+42 −42

File changed.

Preview size limit exceeded, changes collapsed.