Isis 3 Programmer Reference
|
Viewport for Isis Chips. More...
#include <ChipViewport.h>
Classes | |
class | BandInfo |
Sets the mapping for gray band stretch. More... | |
Public Slots | |
void | autoStretch () |
Apply automatic stretch using data from entire chip. More... | |
void | stretchFromCubeViewport (Stretch *, CubeViewport *) |
Applies a new stretch to the specified cube viewport. More... | |
void | changeStretchLock (int) |
Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.) More... | |
void | setPoints (bool checked) |
Slot to set whether control points are drawn. More... | |
void | setCross (bool checked) |
Slot to change state of crosshair. More... | |
void | rotateChip (int rotation) |
Slot to rotate chip. More... | |
void | setCircle (bool checked) |
Slot to change state of circle. More... | |
void | setCircleSize (int size) |
Set the size of the circle. More... | |
void | geomChip (Chip *matchChip, Cube *matchChipCube) |
Slot to geom chip (apply geometry transformation) More... | |
void | nogeomChip () |
Slot to un-geom chip (revert geometry transformation) More... | |
void | panUp () |
Pan up. More... | |
void | panDown () |
Pan down. More... | |
void | panLeft () |
Pan left. More... | |
void | panRight () |
Pan right. More... | |
void | zoomIn () |
Zoom in. More... | |
void | zoomOut () |
Zoom out. More... | |
void | zoom1 () |
Zoom by a factor of one. More... | |
void | zoom (double zoomFactor) |
Zoom by a specified factor. More... | |
void | refreshView (double tackSample, double tackLine) |
Slot to refresh viewport when the tack point has changed. More... | |
void | setControlNet (ControlNet *newControlNet) |
sets the ControlNet to be used for drawing measure locations More... | |
Signals | |
void | tackPointChanged (double) |
< Signal sent when tack point changes More... | |
void | userMovedTackPoint () |
Public Member Functions | |
ChipViewport (int width, int height, QWidget *parent=0) | |
Construct an empty viewport. More... | |
virtual | ~ChipViewport () |
Destructor. More... | |
bool | cubeToViewport (double samp, double line, int &x, int &y) |
Get viewport x and y from cube sample and line. More... | |
void | setChip (Chip *chip, Cube *chipCube) |
Set chip. More... | |
void | loadView (ChipViewport &newView) |
Load with another ChipViewport, used for blinking. More... | |
Chip * | chip () const |
Return chip. More... | |
Cube * | chipCube () const |
int | chipSamples () const |
Return the number of samples in the chip. More... | |
int | chipLines () const |
Return the number of lines in the chip. More... | |
int | grayBand () const |
Return the gray band currently viewed. More... | |
double | tackSample () |
Return the position of cube under cross hair. More... | |
double | tackLine () |
Returns tack line. More... | |
double | zoomFactor () |
Return the zoom factor. More... | |
Stretch | grayStretch () const |
Draw X on point. More... | |
Protected Member Functions | |
void | paintEvent (QPaintEvent *e) |
Repaint the viewport. More... | |
void | enterEvent (QEvent *e) |
If mouse enters, make sure key events are processed w/o clicking. More... | |
void | keyPressEvent (QKeyEvent *e) |
Process arrow keystrokes on cube. More... | |
void | mousePressEvent (QMouseEvent *event) |
Process mouse events. More... | |
Private Member Functions | |
void | reloadChip (double tackSample=0., double tackLine=0.) |
Reloads the chip at the given tack point on the cube. More... | |
void | computeStretch (Stretch &stretch, bool force=false) |
Compute automatic stretch for a portion of the cube. More... | |
void | paintImage () |
Paints the chip viewport after the chip has been updated. More... | |
Private Attributes | |
BandInfo | m_gray |
Info for the gray bands. More... | |
Chip * | m_chip |
The chip. More... | |
Cube * | m_chipCube |
The chip's cube. More... | |
int | m_width |
Chip width. More... | |
int | m_height |
Chip height. More... | |
bool | m_geomIt |
geomIt? More... | |
Chip * | m_matchChip |
The matching chip. More... | |
Cube * | m_matchChipCube |
The matching chip's cube. More... | |
double | m_zoomFactor |
Zoom Factor. More... | |
int | m_rotation |
Rotation. More... | |
QImage * | m_image |
The image. More... | |
bool | m_paintImage |
Paint Image? More... | |
bool | m_showPoints |
Draw control points. More... | |
bool | m_cross |
Draw crosshair. More... | |
bool | m_circle |
Draw circle. More... | |
int | m_circleSize |
Circle size. More... | |
ChipViewport * | m_tempView |
Temporary viewport. More... | |
ControlNet * | m_controlNet |
bool | m_stretchLocked |
Whether or not to lock the stretch when transforming. More... | |
Stretch * | m_stretch |
Current stretch on the chip viewport. More... | |
Viewport for Isis Chips.
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 85 of file ChipViewport.h.
Isis::ChipViewport::ChipViewport | ( | int | width, |
int | height, | ||
QWidget * | parent = 0 |
||
) |
Construct an empty viewport.
width | The width of the viewport |
height | The height of the viewport |
parent | The parent widget |
Definition at line 27 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.
|
virtual |
|
slot |
Apply automatic stretch using data from entire chip.
Definition at line 127 of file ChipViewport.cpp.
References computeStretch(), m_gray, paintImage(), and Isis::ChipViewport::BandInfo::stretch.
Referenced by geomChip(), nogeomChip(), reloadChip(), rotateChip(), and setChip().
|
slot |
Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.)
newStatus | Non-zero locks the stretch |
Definition at line 174 of file ChipViewport.cpp.
References m_stretchLocked.
|
inline |
Return chip.
Definition at line 102 of file ChipViewport.h.
References m_chip.
Referenced by setChip().
|
inline |
Return the number of lines in the chip.
Definition at line 116 of file ChipViewport.h.
References Isis::Chip::Lines(), and m_chip.
|
inline |
Return the number of samples in the chip.
Definition at line 111 of file ChipViewport.h.
References m_chip, and Isis::Chip::Samples().
|
private |
Compute automatic stretch for a portion of the cube.
If the stretch is locked and force is false, no computations will be performed.
stretch | Reference to the stretch to be computed (if unlocked) |
force | If true, forces the stretch to be computed. |
Definition at line 189 of file ChipViewport.cpp.
References Isis::Statistics::AddData(), Isis::Stretch::AddPair(), Isis::Statistics::BestMaximum(), Isis::Statistics::BestMinimum(), Isis::Stretch::ClearPairs(), Isis::Chip::GetValue(), Isis::Chip::Lines(), m_chip, m_stretch, m_stretchLocked, and Isis::Chip::Samples().
Referenced by autoStretch(), and stretchFromCubeViewport().
bool Isis::ChipViewport::cubeToViewport | ( | double | samp, |
double | line, | ||
int & | x, | ||
int & | y | ||
) |
Get viewport x and y from cube sample and line.
samp | Sample in cube |
line | Line in cube |
x | Calcualated viewport x coordinate |
y | Calcualated viewport y coordinate |
Definition at line 77 of file ChipViewport.cpp.
References Isis::Chip::ChipLine(), Isis::Chip::ChipSample(), Isis::Chip::IsInsideChip(), m_chip, and Isis::Chip::SetCubePosition().
Referenced by paintEvent().
|
protected |
If mouse enters, make sure key events are processed w/o clicking.
e | QEvent |
Definition at line 478 of file ChipViewport.cpp.
Slot to geom chip (apply geometry transformation)
matchChip | The matching chip for the geometry |
matchChipCube | The matching chip's cube for the geometry |
Definition at line 613 of file ChipViewport.cpp.
References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_geomIt, m_matchChip, m_matchChipCube, and Isis::IException::toString().
Referenced by Isis::ControlMeasureEditWidget::blinkStartRight(), Isis::ControlPointEdit::setGeom(), Isis::ControlMeasureEditWidget::setGeom(), Isis::ControlPointEdit::updateRightGeom(), and Isis::ControlMeasureEditWidget::updateRightGeom().
|
inline |
Return the gray band currently viewed.
Definition at line 121 of file ChipViewport.h.
References Isis::ChipViewport::BandInfo::band, and m_gray.
|
inline |
Draw X on point.
Return the gray band stretch
Definition at line 136 of file ChipViewport.h.
References m_gray, and Isis::ChipViewport::BandInfo::stretch.
|
protected |
Process arrow keystrokes on cube.
e | QKeyEvent |
Definition at line 488 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
void Isis::ChipViewport::loadView | ( | ChipViewport & | newView | ) |
Load with another ChipViewport, used for blinking.
Load with info from given ChipViewport
newView | The chip viewport to load from |
Definition at line 334 of file ChipViewport.cpp.
References m_tempView.
Referenced by Isis::ControlPointEdit::updateBlink(), Isis::ControlMeasureEditWidget::updateBlink(), and Isis::ControlMeasureEditWidget::updateBlinkRight().
|
protected |
Process mouse events.
event | QMouseEvent |
Definition at line 526 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), and Isis::Chip::SetChipPosition().
|
slot |
Slot to un-geom chip (revert geometry transformation)
Definition at line 641 of file ChipViewport.cpp.
References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_geomIt, m_rotation, m_zoomFactor, and Isis::IException::toString().
Referenced by Isis::ControlPointEdit::setNoGeom(), Isis::ControlMeasureEditWidget::setNoGeom(), Isis::ControlPointEdit::setRotate(), and Isis::ControlMeasureEditWidget::setRotate().
|
protected |
Repaint the viewport.
e | QPaintEvent |
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 256 of file ChipViewport.cpp.
References Isis::SerialNumber::Compose(), cubeToViewport(), Isis::ControlPoint::Fixed, Isis::ControlNet::GetCubeSerials(), Isis::ControlNet::GetMeasuresInCube(), Isis::ControlNet::GetNumPoints(), Isis::ControlPoint::GetType(), m_chipCube, m_circle, m_circleSize, m_cross, m_height, m_image, m_showPoints, m_tempView, and m_width.
|
private |
Paints the chip viewport after the chip has been updated.
Definition at line 228 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().
|
slot |
Pan down.
Definition at line 378 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
|
slot |
Pan left.
Definition at line 391 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
|
slot |
Pan right.
Definition at line 404 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
|
slot |
Pan up.
Definition at line 365 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), m_chip, reloadChip(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
|
slot |
Slot to refresh viewport when the tack point has changed.
tackSample | Sample on the cube to load the chip viewport at (center) |
tackLine | Line on the cube to load the chip viewport at (center) |
Definition at line 468 of file ChipViewport.cpp.
References reloadChip(), tackLine(), and tackSample().
|
private |
Reloads the chip at the given tack point on the cube.
tackSample | Sample in the cube to load the chip on (center) |
tackLine | Line in the cube to load the chip on (center) |
IException::Programmer | "Can not view NULL chip pointer" |
Definition at line 699 of file ChipViewport.cpp.
References _FILEINFO_, 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(), Isis::IException::toString(), and Isis::IException::User.
Referenced by keyPressEvent(), mousePressEvent(), panDown(), panLeft(), panRight(), panUp(), refreshView(), zoom(), zoom1(), zoomIn(), and zoomOut().
|
slot |
Slot to rotate chip.
rotation | How much to rotate the chip |
Definition at line 669 of file ChipViewport.cpp.
References autoStretch(), Isis::Chip::Load(), m_chip, m_chipCube, m_rotation, m_zoomFactor, and Isis::IException::toString().
Set chip.
Set the chip for this ChipViewport.
chip | Pointer to the chip to set the viewport with |
chipCube | Pointer to the chip's cube |
IException::Programmer | "Can not view NULL chip pointer" |
Definition at line 102 of file ChipViewport.cpp.
References _FILEINFO_, 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::blinkStartRight(), Isis::ControlPointEdit::setLeftMeasure(), Isis::ControlMeasureEditWidget::setLeftMeasure(), Isis::ControlPointEdit::setRightMeasure(), and Isis::ControlMeasureEditWidget::setRightMeasure().
|
slot |
Slot to change state of circle.
checked | Circle set to be drawn if true |
Definition at line 580 of file ChipViewport.cpp.
References m_circle.
Referenced by Isis::ControlPointEdit::setCircle(), and Isis::ControlMeasureEditWidget::setCircle().
|
slot |
Set the size of the circle.
size | The size of the circle |
Definition at line 595 of file ChipViewport.cpp.
References m_circleSize.
|
inlineslot |
sets the ControlNet to be used for drawing measure locations
newControlNet | The new ControlNet to be used |
Definition at line 181 of file ChipViewport.h.
|
slot |
Slot to change state of crosshair.
checked | Crosshair set to be drawn if true |
Definition at line 564 of file ChipViewport.cpp.
References m_cross.
|
slot |
Slot to set whether control points are drawn.
checked | Control points are set to be drawn if true |
Definition at line 548 of file ChipViewport.cpp.
References m_showPoints.
Referenced by Isis::ChipViewportsWidget::showPoints().
|
slot |
Applies a new stretch to the specified cube viewport.
newStretch | Pointer to the new stretch to apply |
cvp | Pointer to the cube viewport to apply the stretch to |
Definition at line 140 of file ChipViewport.cpp.
References computeStretch(), Isis::CubeViewport::cube(), Isis::Cube::fileName(), m_chipCube, m_gray, m_stretch, paintImage(), and Isis::ChipViewport::BandInfo::stretch.
double Isis::ChipViewport::tackLine | ( | ) |
Returns tack line.
Definition at line 356 of file ChipViewport.cpp.
References Isis::Chip::CubeLine(), m_chip, Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
Referenced by Isis::ControlPointEdit::findPoint(), Isis::ControlMeasureEditWidget::findPoint(), refreshView(), reloadChip(), Isis::ControlPointEdit::saveMeasure(), Isis::ControlMeasureEditWidget::saveMeasure(), Isis::ControlPointEdit::updateLeftPositionLabel(), Isis::ControlMeasureEditWidget::updateLeftPositionLabel(), Isis::ControlPointEdit::updateRightPositionLabel(), and Isis::ControlMeasureEditWidget::updateRightPositionLabel().
|
signal |
< Signal sent when tack point changes
Referenced by reloadChip(), and setChip().
double Isis::ChipViewport::tackSample | ( | ) |
Return the position of cube under cross hair.
Returns tack sample.
Definition at line 345 of file ChipViewport.cpp.
References Isis::Chip::CubeSample(), m_chip, Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
Referenced by Isis::ControlPointEdit::findPoint(), Isis::ControlMeasureEditWidget::findPoint(), refreshView(), reloadChip(), Isis::ControlPointEdit::saveMeasure(), Isis::ControlMeasureEditWidget::saveMeasure(), Isis::ControlPointEdit::updateLeftPositionLabel(), Isis::ControlMeasureEditWidget::updateLeftPositionLabel(), Isis::ControlPointEdit::updateRightPositionLabel(), and Isis::ControlMeasureEditWidget::updateRightPositionLabel().
|
slot |
Zoom by a specified factor.
zoomFactor | The zoom factor |
Definition at line 446 of file ChipViewport.cpp.
References m_zoomFactor, reloadChip(), and zoomFactor().
Referenced by Isis::ControlMeasureEditWidget::blinkStartRight(), Isis::ControlPointEdit::setZoomLink(), Isis::ControlMeasureEditWidget::setZoomLink(), Isis::ControlPointEdit::updateLeftPositionLabel(), and Isis::ControlMeasureEditWidget::updateLeftPositionLabel().
|
slot |
Zoom by a factor of one.
Definition at line 435 of file ChipViewport.cpp.
References m_zoomFactor, and reloadChip().
double Isis::ChipViewport::zoomFactor | ( | ) |
Return the zoom factor.
Returns the current zoom factor.
Definition at line 457 of file ChipViewport.cpp.
References m_zoomFactor.
Referenced by Isis::ControlMeasureEditWidget::blinkStartRight(), Isis::ControlPointEdit::setZoomLink(), Isis::ControlMeasureEditWidget::setZoomLink(), Isis::ControlPointEdit::updateLeftPositionLabel(), Isis::ControlMeasureEditWidget::updateLeftPositionLabel(), and zoom().
|
slot |
Zoom in.
Definition at line 417 of file ChipViewport.cpp.
References m_zoomFactor, and reloadChip().
|
slot |
Zoom out.
Definition at line 426 of file ChipViewport.cpp.
References m_zoomFactor, and reloadChip().
|
private |
The chip.
Definition at line 222 of file ChipViewport.h.
Referenced by chip(), chipLines(), chipSamples(), ChipViewport(), computeStretch(), cubeToViewport(), geomChip(), keyPressEvent(), mousePressEvent(), nogeomChip(), paintImage(), panDown(), panLeft(), panRight(), panUp(), reloadChip(), rotateChip(), setChip(), tackLine(), and tackSample().
|
private |
The chip's cube.
Definition at line 223 of file ChipViewport.h.
Referenced by ChipViewport(), geomChip(), nogeomChip(), paintEvent(), reloadChip(), rotateChip(), setChip(), and stretchFromCubeViewport().
|
private |
Draw circle.
Definition at line 239 of file ChipViewport.h.
Referenced by ChipViewport(), paintEvent(), and setCircle().
|
private |
Circle size.
Definition at line 240 of file ChipViewport.h.
Referenced by paintEvent(), and setCircleSize().
|
private |
Draw crosshair.
Definition at line 238 of file ChipViewport.h.
Referenced by ChipViewport(), paintEvent(), and setCross().
|
private |
geomIt?
Definition at line 228 of file ChipViewport.h.
Referenced by ChipViewport(), geomChip(), nogeomChip(), and reloadChip().
|
private |
Info for the gray bands.
Definition at line 221 of file ChipViewport.h.
Referenced by autoStretch(), grayBand(), grayStretch(), paintImage(), and stretchFromCubeViewport().
|
private |
Chip height.
Definition at line 226 of file ChipViewport.h.
Referenced by ChipViewport(), and paintEvent().
|
private |
The image.
Definition at line 235 of file ChipViewport.h.
Referenced by ChipViewport(), paintEvent(), paintImage(), and setChip().
|
private |
The matching chip.
Definition at line 229 of file ChipViewport.h.
Referenced by ChipViewport(), geomChip(), and reloadChip().
|
private |
The matching chip's cube.
Definition at line 230 of file ChipViewport.h.
Referenced by ChipViewport(), geomChip(), and reloadChip().
|
private |
Paint Image?
Definition at line 236 of file ChipViewport.h.
|
private |
Rotation.
Definition at line 233 of file ChipViewport.h.
Referenced by ChipViewport(), nogeomChip(), reloadChip(), rotateChip(), and setChip().
|
private |
Draw control points.
Definition at line 237 of file ChipViewport.h.
Referenced by paintEvent(), and setPoints().
|
private |
Current stretch on the chip viewport.
Definition at line 254 of file ChipViewport.h.
Referenced by ChipViewport(), computeStretch(), stretchFromCubeViewport(), and ~ChipViewport().
|
private |
Whether or not to lock the stretch when transforming.
Definition at line 253 of file ChipViewport.h.
Referenced by changeStretchLock(), ChipViewport(), and computeStretch().
|
private |
Temporary viewport.
Definition at line 242 of file ChipViewport.h.
Referenced by ChipViewport(), loadView(), and paintEvent().
|
private |
Chip width.
Definition at line 225 of file ChipViewport.h.
Referenced by ChipViewport(), and paintEvent().
|
private |
Zoom Factor.
Definition at line 232 of file ChipViewport.h.
Referenced by ChipViewport(), nogeomChip(), reloadChip(), rotateChip(), setChip(), zoom(), zoom1(), zoomFactor(), zoomIn(), and zoomOut().