Isis 3 Programmer Reference
Isis::ChipViewport Class Reference

Viewport for Isis Chips. More...

#include <ChipViewport.h>

Inheritance diagram for Isis::ChipViewport:
Inheritance graph
Collaboration diagram for Isis::ChipViewport:
Collaboration graph

Classes

class  BandInfo
 Sets the mapping for gray band stretch. More...
 

Public Slots

void autoStretch ()
 Apply automatic stretch using data from entire chip.
 
void stretchFromCubeViewport (Stretch *, CubeViewport *)
 Applies a new stretch to the specified cube viewport.
 
void changeStretchLock (int)
 Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.)
 
void setPoints (bool checked)
 Slot to set whether control points are drawn.
 
void setCross (bool checked)
 Slot to change state of crosshair.
 
void rotateChip (int rotation)
 Slot to rotate chip.
 
void setCircle (bool checked)
 Slot to change state of circle.
 
void setCircleSize (int size)
 Set the size of the circle.
 
void geomChip (Chip *matchChip, Cube *matchChipCube)
 Slot to geom chip (apply geometry transformation)
 
void nogeomChip ()
 Slot to un-geom chip (revert geometry transformation)
 
void panUp ()
 Pan up.
 
void panDown ()
 Pan down.
 
void panLeft ()
 Pan left.
 
void panRight ()
 Pan right.
 
void zoomIn ()
 Zoom in.
 
void zoomOut ()
 Zoom out.
 
void zoom1 ()
 Zoom by a factor of one.
 
void zoom (double zoomFactor)
 Zoom by a specified factor.
 
void refreshView (double tackSample, double tackLine)
 Slot to refresh viewport when the tack point has changed.
 
void setControlNet (ControlNet *newControlNet)
 sets the ControlNet to be used for drawing measure locations
 

Signals

void tackPointChanged (double)
 < Signal sent when tack point changes
 
void userMovedTackPoint ()
 

Public Member Functions

 ChipViewport (int width, int height, QWidget *parent=0)
 Construct an empty viewport.
 
virtual ~ChipViewport ()
 Destructor.
 
bool cubeToViewport (double samp, double line, int &x, int &y)
 Get viewport x and y from cube sample and line.
 
void setChip (Chip *chip, Cube *chipCube)
 Set chip.
 
void loadView (ChipViewport &newView)
 Load with another ChipViewport, used for blinking.
 
Chipchip () const
 Return chip.
 
CubechipCube () const
 
int chipSamples () const
 Return the number of samples in the chip.
 
int chipLines () const
 Return the number of lines in the chip.
 
int grayBand () const
 Return the gray band currently viewed.
 
double tackSample ()
 Return the position of cube under cross hair.
 
double tackLine ()
 Returns tack line.
 
double zoomFactor ()
 Return the zoom factor.
 
Stretch grayStretch () const
 Draw X on point.
 

Protected Member Functions

void paintEvent (QPaintEvent *e)
 Repaint the viewport.
 
void enterEvent (QEvent *e)
 If mouse enters, make sure key events are processed w/o clicking.
 
void keyPressEvent (QKeyEvent *e)
 Process arrow keystrokes on cube.
 
void mousePressEvent (QMouseEvent *event)
 Process mouse events.
 

Private Member Functions

void reloadChip (double tackSample=0., double tackLine=0.)
 Reloads the chip at the given tack point on the cube.
 
void computeStretch (Stretch &stretch, bool force=false)
 Compute automatic stretch for a portion of the cube.
 
void paintImage ()
 Paints the chip viewport after the chip has been updated.
 

Private Attributes

BandInfo m_gray
 Info for the gray bands.
 
Chipm_chip
 The chip.
 
Cubem_chipCube
 The chip's cube.
 
int m_width
 Chip width.
 
int m_height
 Chip height.
 
bool m_geomIt
 geomIt?
 
Chipm_matchChip
 The matching chip.
 
Cubem_matchChipCube
 The matching chip's cube.
 
double m_zoomFactor
 Zoom Factor.
 
int m_rotation
 Rotation.
 
QImage * m_image
 The image.
 
bool m_paintImage
 Paint Image?
 
bool m_showPoints
 Draw control points.
 
bool m_cross
 Draw crosshair.
 
bool m_circle
 Draw circle.
 
int m_circleSize
 Circle size.
 
ChipViewportm_tempView
 Temporary viewport.
 
ControlNetm_controlNet
 
bool m_stretchLocked
 Whether or not to lock the stretch when transforming.
 
Stretchm_stretch
 Current stretch on the chip viewport.
 

Detailed Description

Viewport for Isis Chips.

Author
2007-05-01 Tracie Sucharski
History

2008-09-09 Tracie Sucharski - Added setCircle and setCircleSize methods.

2010-06-16 Jeannie Walldren - Modified geomChip(), nogeomChip(), rotateChip() and reloadChip() to catch possible iExceptions from Chip's Load() method and display Error in QMessageBox

2010-11-17 Eric Hyer - Added cubeToViewport method and setControlNet slot. paintEvent can now use the control net to paint measures in the viewport.

2010-11-22 Eric Hyer - ChipViewports can now be stretched by stretching CubeViewports opened to the same cube

2010-11-24 Eric Hyer - Fixed bug where crosses were painted one screen pixel off on each direction. Also no longer paint cross under the large main red crosses.

2010-12-01 Eric Hyer - Added stretch locking

2011-06-07 Debbie A. Cook and Tracie Sucharski - Changed point type "Ground" to "Fixed".

2011-06-14 Tracie Sucharski - Added mouseClick signal. Qnet needed to know if user moved the tackpoint vs. simply loading a new chip, or geoming the chip.

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.

2011-09-14 Tracie Sucharski - Added user option to determine whether control points are drawn.

2012-07-26 Tracie Sucharski - Added method to return zoom factor and slot to zoom to a specific zoom factor.

2014-09-05 Kim Oyama - Added default initialization of Image to ChipViewport construtor.

2015-12-08 Jeannie Backer - Fixed whitespace per ISIS coding standards.

2016-03-31 Tracie Sucharski - Added method to return the chip cube.

2016-06-07 Ian Humphrey - Updated documentation and coding standards. Fixes #3958.

Definition at line 71 of file ChipViewport.h.

Constructor & Destructor Documentation

◆ ChipViewport()

Isis::ChipViewport::ChipViewport ( int width,
int height,
QWidget * parent = 0 )

Construct an empty viewport.

Parameters
widthThe width of the viewport
heightThe height of the viewport
parentThe parent widget

Definition at line 33 of file ChipViewport.cpp.

References m_chip, m_chipCube, m_circle, m_cross, m_geomIt, m_height, m_image, m_matchChip, m_matchChipCube, m_rotation, m_stretch, m_stretchLocked, m_tempView, m_width, and m_zoomFactor.

◆ ~ChipViewport()

Isis::ChipViewport::~ChipViewport ( )
virtual

Destructor.

Definition at line 65 of file ChipViewport.cpp.

References m_stretch.

Member Function Documentation

◆ autoStretch

void Isis::ChipViewport::autoStretch ( )
slot

Apply automatic stretch using data from entire chip.

Definition at line 133 of file ChipViewport.cpp.

References computeStretch(), m_gray, paintImage(), and Isis::ChipViewport::BandInfo::stretch.

Referenced by geomChip(), nogeomChip(), reloadChip(), rotateChip(), and setChip().

◆ changeStretchLock

void Isis::ChipViewport::changeStretchLock ( int newStatus)
slot

Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.)

Parameters
newStatusNon-zero locks the stretch

Definition at line 178 of file ChipViewport.cpp.

References m_stretchLocked.

◆ chip()

Chip * Isis::ChipViewport::chip ( ) const
inline

Return chip.

Definition at line 88 of file ChipViewport.h.

References m_chip.

Referenced by setChip().

◆ chipCube()

Cube * Isis::ChipViewport::chipCube ( ) const
inline

Definition at line 92 of file ChipViewport.h.

◆ chipLines()

int Isis::ChipViewport::chipLines ( ) const
inline

Return the number of lines in the chip.

Definition at line 102 of file ChipViewport.h.

References Isis::Chip::Lines(), and m_chip.

◆ chipSamples()

int Isis::ChipViewport::chipSamples ( ) const
inline

Return the number of samples in the chip.

Definition at line 97 of file ChipViewport.h.

References m_chip, and Isis::Chip::Samples().

◆ computeStretch()

void Isis::ChipViewport::computeStretch ( Stretch & stretch,
bool force = false )
private

Compute automatic stretch for a portion of the cube.

If the stretch is locked and force is false, no computations will be performed.

Parameters
stretchReference to the stretch to be computed (if unlocked)
forceIf true, forces the stretch to be computed.

Definition at line 193 of file ChipViewport.cpp.

References Isis::Stretch::AddPair(), Isis::Stretch::ClearPairs(), Isis::Chip::GetValue(), Isis::Chip::Lines(), m_chip, m_stretch, m_stretchLocked, and Isis::Chip::Samples().

Referenced by autoStretch(), and stretchFromCubeViewport().

◆ cubeToViewport()

bool Isis::ChipViewport::cubeToViewport ( double samp,
double line,
int & x,
int & y )

Get viewport x and y from cube sample and line.

Parameters
sampSample in cube
lineLine in cube
xCalcualated viewport x coordinate
yCalcualated viewport y coordinate
Returns
bool true if the point is contained in the viewport, false otherwise

Definition at line 83 of file ChipViewport.cpp.

References Isis::Chip::ChipLine(), Isis::Chip::ChipSample(), Isis::Chip::IsInsideChip(), m_chip, and Isis::Chip::SetCubePosition().

Referenced by paintEvent().

◆ enterEvent()

void Isis::ChipViewport::enterEvent ( QEvent * e)
protected

If mouse enters, make sure key events are processed w/o clicking.

Parameters
eQEvent

Definition at line 482 of file ChipViewport.cpp.

◆ geomChip

void Isis::ChipViewport::geomChip ( Chip * matchChip,
Cube * matchChipCube )
slot

Slot to geom chip (apply geometry transformation)

Parameters
matchChipThe matching chip for the geometry
matchChipCubeThe matching chip's cube for the geometry
History
2010-06-16 Jeannie Walldren - Catch possible iException from Chip's Load() method and display in QMessageBox

Definition at line 617 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_geomIt, m_matchChip, and m_matchChipCube.

Referenced by Isis::ControlMeasureEditWidget::setGeom(), Isis::ControlPointEdit::setGeom(), Isis::ControlMeasureEditWidget::updateRightGeom(), and Isis::ControlPointEdit::updateRightGeom().

◆ grayBand()

int Isis::ChipViewport::grayBand ( ) const
inline

Return the gray band currently viewed.

Definition at line 107 of file ChipViewport.h.

References Isis::ChipViewport::BandInfo::band, and m_gray.

◆ grayStretch()

Stretch Isis::ChipViewport::grayStretch ( ) const
inline

Draw X on point.

Return the gray band stretch

Definition at line 122 of file ChipViewport.h.

References m_gray, and Isis::ChipViewport::BandInfo::stretch.

◆ keyPressEvent()

void Isis::ChipViewport::keyPressEvent ( QKeyEvent * e)
protected

◆ loadView()

void Isis::ChipViewport::loadView ( ChipViewport & newView)

Load with another ChipViewport, used for blinking.

Load with info from given ChipViewport.

Parameters
newViewThe chip viewport to load from

Definition at line 338 of file ChipViewport.cpp.

References m_tempView.

Referenced by Isis::ControlMeasureEditWidget::updateBlink(), Isis::ControlPointEdit::updateBlink(), and Isis::ControlMeasureEditWidget::updateBlinkRight().

◆ mousePressEvent()

void Isis::ChipViewport::mousePressEvent ( QMouseEvent * event)
protected

Process mouse events.

Parameters
eventQMouseEvent
History
2011-09-29 Tracie Sucharski - Added the setFocus call so that arrow keys would work.

Definition at line 530 of file ChipViewport.cpp.

References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), and Isis::Chip::SetChipPosition().

◆ nogeomChip

void Isis::ChipViewport::nogeomChip ( )
slot

Slot to un-geom chip (revert geometry transformation)

History
2010-06-16 Jeannie Walldren - Catch possible iException from Chip's Load() method and display in QMessageBox

Definition at line 645 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_geomIt, m_rotation, and m_zoomFactor.

Referenced by Isis::ControlMeasureEditWidget::setNoGeom(), Isis::ControlPointEdit::setNoGeom(), Isis::ControlMeasureEditWidget::setRotate(), and Isis::ControlPointEdit::setRotate().

◆ paintEvent()

void Isis::ChipViewport::paintEvent ( QPaintEvent * e)
protected

Repaint the viewport.

Parameters
eQPaintEvent
History

2011-08-23 Tracie Sucharski - Use the GetMeasuresInCube method from ControlNet to get list of measures rather than searching through entire net.

2011-11-09 Tracie Sucharski - If there are no measures for this cube, return.

Definition at line 260 of file ChipViewport.cpp.

References Isis::SerialNumber::Compose(), cubeToViewport(), Isis::ControlPoint::Fixed, Isis::ControlNet::GetCubeSerials(), Isis::ControlNet::GetMeasuresInCube(), Isis::ControlNet::GetNumPoints(), m_chipCube, m_circle, m_circleSize, m_cross, m_height, m_image, m_showPoints, m_tempView, and m_width.

◆ paintImage()

void Isis::ChipViewport::paintImage ( )
private

Paints the chip viewport after the chip has been updated.

Definition at line 232 of file ChipViewport.cpp.

References Isis::Chip::GetValue(), Isis::Chip::Lines(), m_chip, m_gray, m_image, Isis::Stretch::Map(), Isis::Chip::Samples(), and Isis::ChipViewport::BandInfo::stretch.

Referenced by autoStretch(), and stretchFromCubeViewport().

◆ panDown

void Isis::ChipViewport::panDown ( )
slot

◆ panLeft

void Isis::ChipViewport::panLeft ( )
slot

◆ panRight

void Isis::ChipViewport::panRight ( )
slot

◆ panUp

void Isis::ChipViewport::panUp ( )
slot

◆ refreshView

void Isis::ChipViewport::refreshView ( double tackSample,
double tackLine )
slot

Slot to refresh viewport when the tack point has changed.

Parameters
tackSampleSample on the cube to load the chip viewport at (center)
tackLineLine on the cube to load the chip viewport at (center)

Definition at line 472 of file ChipViewport.cpp.

References reloadChip(), tackLine(), and tackSample().

◆ reloadChip()

void Isis::ChipViewport::reloadChip ( double tackSample = 0.,
double tackLine = 0. )
private

Reloads the chip at the given tack point on the cube.

Parameters
tackSampleSample in the cube to load the chip on (center)
tackLineLine in the cube to load the chip on (center)
Exceptions
IException::Programmer"Can not view NULL chip pointer"
History
2010-06-16 Jeannie Walldren - Catch possible iException from Chip's Load() method and display in QMessageBox

Definition at line 703 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_geomIt, m_matchChip, m_matchChipCube, m_rotation, m_zoomFactor, Isis::IException::Programmer, Isis::Chip::TackCube(), tackLine(), tackPointChanged(), tackSample(), and Isis::IException::User.

Referenced by keyPressEvent(), mousePressEvent(), panDown(), panLeft(), panRight(), panUp(), refreshView(), zoom(), zoom1(), zoomIn(), and zoomOut().

◆ rotateChip

void Isis::ChipViewport::rotateChip ( int rotation)
slot

Slot to rotate chip.

Parameters
rotationHow much to rotate the chip
History
2010-06-16 Jeannie Walldren - Catch possible iException from Chip's Load() method and display in QMessageBox

Definition at line 673 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_rotation, and m_zoomFactor.

◆ setChip()

void Isis::ChipViewport::setChip ( Chip * chip,
Cube * chipCube )

Set chip.

Set the chip for this ChipViewport.

Parameters
chipPointer to the chip to set the viewport with
chipCubePointer to the chip's cube
Exceptions
IException::Programmer"Can not view NULL chip pointer"
Author
Tracie Sucharski
History
2009-14-2009 Tracie Sucharski - Make sure the m_image is clear before allocating new.

Definition at line 108 of file ChipViewport.cpp.

References autoStretch(), chip(), Isis::Chip::Lines(), m_chip, m_chipCube, m_image, m_rotation, m_zoomFactor, Isis::IException::Programmer, Isis::Chip::Samples(), and tackPointChanged().

Referenced by Isis::ControlMeasureEditWidget::setLeftMeasure(), Isis::ControlPointEdit::setLeftMeasure(), Isis::ControlMeasureEditWidget::setRightMeasure(), and Isis::ControlPointEdit::setRightMeasure().

◆ setCircle

void Isis::ChipViewport::setCircle ( bool checked)
slot

Slot to change state of circle.

Parameters
checkedCircle set to be drawn if true

Definition at line 584 of file ChipViewport.cpp.

References m_circle.

Referenced by Isis::ControlMeasureEditWidget::setCircle(), and Isis::ControlPointEdit::setCircle().

◆ setCircleSize

void Isis::ChipViewport::setCircleSize ( int size)
slot

Set the size of the circle.

Parameters
sizeThe size of the circle

Definition at line 599 of file ChipViewport.cpp.

References m_circleSize.

◆ setControlNet

void Isis::ChipViewport::setControlNet ( ControlNet * newControlNet)
inlineslot

sets the ControlNet to be used for drawing measure locations

Parameters
newControlNetThe new ControlNet to be used

Definition at line 167 of file ChipViewport.h.

◆ setCross

void Isis::ChipViewport::setCross ( bool checked)
slot

Slot to change state of crosshair.

Parameters
checkedCrosshair set to be drawn if true

Definition at line 568 of file ChipViewport.cpp.

References m_cross.

◆ setPoints

void Isis::ChipViewport::setPoints ( bool checked)
slot

Slot to set whether control points are drawn.

Parameters
checkedControl points are set to be drawn if true

Definition at line 552 of file ChipViewport.cpp.

References m_showPoints.

◆ stretchFromCubeViewport

void Isis::ChipViewport::stretchFromCubeViewport ( Stretch * newStretch,
CubeViewport * cvp )
slot

Applies a new stretch to the specified cube viewport.

Parameters
newStretchPointer to the new stretch to apply
cvpPointer to the cube viewport to apply the stretch to

Definition at line 146 of file ChipViewport.cpp.

References computeStretch(), Isis::Cube::fileName(), m_chipCube, m_gray, m_stretch, paintImage(), and Isis::ChipViewport::BandInfo::stretch.

◆ tackLine()

◆ tackPointChanged

void Isis::ChipViewport::tackPointChanged ( double )
signal

< Signal sent when tack point changes

Referenced by reloadChip(), and setChip().

◆ tackSample()

◆ zoom

void Isis::ChipViewport::zoom ( double zoomFactor)
slot

◆ zoom1

void Isis::ChipViewport::zoom1 ( )
slot

Zoom by a factor of one.

Definition at line 439 of file ChipViewport.cpp.

References m_zoomFactor, and reloadChip().

◆ zoomFactor()

double Isis::ChipViewport::zoomFactor ( )

◆ zoomIn

void Isis::ChipViewport::zoomIn ( )
slot

Zoom in.

Definition at line 421 of file ChipViewport.cpp.

References m_zoomFactor, and reloadChip().

◆ zoomOut

void Isis::ChipViewport::zoomOut ( )
slot

Zoom out.

Definition at line 430 of file ChipViewport.cpp.

References m_zoomFactor, and reloadChip().

Member Data Documentation

◆ m_chip

◆ m_chipCube

Cube* Isis::ChipViewport::m_chipCube
private

The chip's cube.

Definition at line 209 of file ChipViewport.h.

Referenced by ChipViewport(), geomChip(), nogeomChip(), paintEvent(), reloadChip(), rotateChip(), setChip(), and stretchFromCubeViewport().

◆ m_circle

bool Isis::ChipViewport::m_circle
private

Draw circle.

Definition at line 225 of file ChipViewport.h.

Referenced by ChipViewport(), paintEvent(), and setCircle().

◆ m_circleSize

int Isis::ChipViewport::m_circleSize
private

Circle size.

Definition at line 226 of file ChipViewport.h.

Referenced by paintEvent(), and setCircleSize().

◆ m_controlNet

ControlNet* Isis::ChipViewport::m_controlNet
private

Definition at line 237 of file ChipViewport.h.

◆ m_cross

bool Isis::ChipViewport::m_cross
private

Draw crosshair.

Definition at line 224 of file ChipViewport.h.

Referenced by ChipViewport(), paintEvent(), and setCross().

◆ m_geomIt

bool Isis::ChipViewport::m_geomIt
private

geomIt?

Definition at line 214 of file ChipViewport.h.

Referenced by ChipViewport(), geomChip(), nogeomChip(), and reloadChip().

◆ m_gray

BandInfo Isis::ChipViewport::m_gray
private

Info for the gray bands.

Definition at line 207 of file ChipViewport.h.

Referenced by autoStretch(), grayBand(), grayStretch(), paintImage(), and stretchFromCubeViewport().

◆ m_height

int Isis::ChipViewport::m_height
private

Chip height.

Definition at line 212 of file ChipViewport.h.

Referenced by ChipViewport(), and paintEvent().

◆ m_image

QImage* Isis::ChipViewport::m_image
private

The image.

Definition at line 221 of file ChipViewport.h.

Referenced by ChipViewport(), paintEvent(), paintImage(), and setChip().

◆ m_matchChip

Chip* Isis::ChipViewport::m_matchChip
private

The matching chip.

Definition at line 215 of file ChipViewport.h.

Referenced by ChipViewport(), geomChip(), and reloadChip().

◆ m_matchChipCube

Cube* Isis::ChipViewport::m_matchChipCube
private

The matching chip's cube.

Definition at line 216 of file ChipViewport.h.

Referenced by ChipViewport(), geomChip(), and reloadChip().

◆ m_paintImage

bool Isis::ChipViewport::m_paintImage
private

Paint Image?

Definition at line 222 of file ChipViewport.h.

◆ m_rotation

int Isis::ChipViewport::m_rotation
private

Rotation.

Definition at line 219 of file ChipViewport.h.

Referenced by ChipViewport(), nogeomChip(), reloadChip(), rotateChip(), and setChip().

◆ m_showPoints

bool Isis::ChipViewport::m_showPoints
private

Draw control points.

Definition at line 223 of file ChipViewport.h.

Referenced by paintEvent(), and setPoints().

◆ m_stretch

Stretch* Isis::ChipViewport::m_stretch
private

Current stretch on the chip viewport.

Definition at line 240 of file ChipViewport.h.

Referenced by ChipViewport(), computeStretch(), stretchFromCubeViewport(), and ~ChipViewport().

◆ m_stretchLocked

bool Isis::ChipViewport::m_stretchLocked
private

Whether or not to lock the stretch when transforming.

Definition at line 239 of file ChipViewport.h.

Referenced by changeStretchLock(), ChipViewport(), and computeStretch().

◆ m_tempView

ChipViewport* Isis::ChipViewport::m_tempView
private

Temporary viewport.

Definition at line 228 of file ChipViewport.h.

Referenced by ChipViewport(), loadView(), and paintEvent().

◆ m_width

int Isis::ChipViewport::m_width
private

Chip width.

Definition at line 211 of file ChipViewport.h.

Referenced by ChipViewport(), and paintEvent().

◆ m_zoomFactor

double Isis::ChipViewport::m_zoomFactor
private

Zoom Factor.

Definition at line 218 of file ChipViewport.h.

Referenced by ChipViewport(), nogeomChip(), reloadChip(), rotateChip(), setChip(), zoom(), zoom1(), zoomFactor(), zoomIn(), and zoomOut().


The documentation for this class was generated from the following files: