USGS

Isis 3.0 Object Programmers' Reference

Home

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

Public Slots

void autoStretch ()
 Apply automatic stretch using data from entire chip.
void stretchFromCubeViewport (Stretch *, CubeViewport *)
void changeStretchLock (int)
void setPoints (bool checked)
 Slot to change state of crosshair.
void setCross (bool checked)
void rotateChip (int rotation)
 Slot to rotate chip.
void setCircle (bool checked)
void setCircleSize (int size)
void geomChip (Chip *matchChip, Cube *matchChipCube)
 Slot to geom chip.
void nogeomChip ()
 Slot to geom chip.
void panUp ()
 Pan down.
void panDown ()
 Pan left.
void panLeft ()
 Pan right.
void panRight ()
void zoomIn ()
 Zoom in.
void zoomOut ()
 Zoom out.
void zoom1 ()
 Zoom by a factor of one.
void zoom (double zoomFactor)
void refreshView (double tackSample, double tackLine)
 If mouse enters, make sure key events are processed w/o clicking.
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.
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)
 Process arrow keystrokes on cube.
void keyPressEvent (QKeyEvent *e)
void mousePressEvent (QMouseEvent *event)
 Process mouse events.

Private Member Functions

void reloadChip (double tackSample=0., double tackLine=0.)
 Reloads the chip.
void computeStretch (Stretch &stretch, bool force=false)
 Compute automatic stretch for a portion of the cube.
void paintImage ()
 Paint QImage.

Private Attributes

BandInfo p_gray
 info for the gray bands.
Chipp_chip
 The chip.
Cubep_chipCube
 The chip's cube.
int p_width
 Chip width.
int p_height
 Chip height.
bool p_geomIt
 geomIt?
Chipp_matchChip
 The matching chip.
Cubep_matchChipCube
 The matching chip's cube.
double p_zoomFactor
 Zoom Factor.
int p_rotation
 Rotation.
QImage * p_image
 The image.
bool p_paintImage
 Paint Image?
bool p_showPoints
 Draw control points.
bool p_cross
 Draw crosshair.
bool p_circle
 Draw circle.
int p_circleSize
 Circle size.
ChipViewportp_tempView
 Temporary viewport.
ControlNetp_controlNet
bool p_stretchLocked
Stretchp_stretch

Detailed Description

Viewport for Isis Chips.

Author
2007-05-01 Tracie Sucharski
History:
2008-09-09 Tracie Sucharski - Added setCircle and setCircleSize methods.
History:
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
History:
2010-11-17 Eric Hyer - Added cubeToViewport method and setControlNet slot. paintEvent can now use the control net to paint measures in the viewport.
History:
2010-11-22 Eric Hyer - ChipViewports can now be stretched by stretching CubeViewports opened to the same cube
History:
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.
History:
2010-12-01 Eric Hyer - Added stretch locking
History:
2011-06-07 Debbie A. Cook and Tracie Sucharski - Changed point type "Ground" to "Fixed".
History:
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.
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:
2011-09-14 Tracie Sucharski - Added user option to determine whether control points are drawn.
History:
2012-07-26 Tracie Sucharski - Added method to return zoom factor and slot to zoom to a specific zoom factor.

Definition at line 85 of file ChipViewport.h.

Constructor & Destructor Documentation

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

Construct an empty viewport.

Definition at line 21 of file ChipViewport.cpp.

References p_chip, p_chipCube, p_circle, p_cross, p_geomIt, p_height, p_image, p_matchChip, p_matchChipCube, p_rotation, p_tempView, p_width, and p_zoomFactor.

Isis::ChipViewport::~ChipViewport ( )
virtual

Destructor.

Definition at line 53 of file ChipViewport.cpp.

Member Function Documentation

void Isis::ChipViewport::autoStretch ( )
slot

Apply automatic stretch using data from entire chip.

Definition at line 114 of file ChipViewport.cpp.

References computeStretch(), p_gray, and paintImage().

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

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

Return chip.

Definition at line 102 of file ChipViewport.h.

References p_chip.

Referenced by setChip().

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

Return the number of lines in the chip.

Definition at line 112 of file ChipViewport.h.

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

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

Return the number of samples in the chip.

Definition at line 107 of file ChipViewport.h.

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

void Isis::ChipViewport::computeStretch ( Stretch stretch,
bool  force = false 
)
private
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
True if the point is contained in the viewport, false otherwise

Definition at line 71 of file ChipViewport.cpp.

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

Referenced by paintEvent().

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

Process arrow keystrokes on cube.

Definition at line 426 of file ChipViewport.cpp.

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

Slot to geom chip.

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

Definition at line 535 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), p_chip, p_chipCube, p_geomIt, p_matchChip, p_matchChipCube, and Isis::IException::toString().

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

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

Return the gray band currently viewed.

Definition at line 117 of file ChipViewport.h.

References p_gray.

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

Draw X on point.

Return the gray band stretch

Definition at line 133 of file ChipViewport.h.

References p_gray.

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

Load with another ChipViewport, used for blinking.

Load with info from given ChipViewport.

Definition at line 297 of file ChipViewport.cpp.

References p_tempView.

Referenced by Isis::ControlPointEdit::updateBlink().

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

Process mouse events.

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

Slot to set whether control points are drawn

Definition at line 469 of file ChipViewport.cpp.

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

void Isis::ChipViewport::nogeomChip ( )
slot

Slot to geom chip.

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

Definition at line 561 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), p_chip, p_chipCube, p_geomIt, p_rotation, p_zoomFactor, and Isis::IException::toString().

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

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

Repaint the viewport.

History:
2011-08-23 Tracie Sucharski - Use the GetMeasuresInCube method from ControlNet to get list of measures rather than searching through entire net.
History:
2011-11-09 Tracie Sucharski - If there are no measures for this cube, return.

Definition at line 224 of file ChipViewport.cpp.

References Isis::SerialNumber::Compose(), cubeToViewport(), Isis::ControlPoint::Fixed, Isis::ControlNet::GetCubeSerials(), Isis::ControlNet::GetMeasuresInCube(), Isis::ControlNet::GetNumPoints(), Isis::ControlPoint::GetType(), p_chipCube, p_circle, p_circleSize, p_cross, p_height, p_image, p_showPoints, p_tempView, and p_width.

void Isis::ChipViewport::paintImage ( )
private

Paint QImage.

Definition at line 197 of file ChipViewport.cpp.

References Isis::Chip::GetValue(), Isis::Chip::Lines(), Isis::Stretch::Map(), p_chip, p_gray, p_image, and Isis::Chip::Samples().

Referenced by autoStretch().

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

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

Definition at line 418 of file ChipViewport.cpp.

References reloadChip().

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

Reloads the chip.

Parameters
tackSample
tackLine
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 _FILEINFO_, autoStretch(), Isis::Chip::Load(), p_chip, p_chipCube, p_geomIt, p_matchChip, p_matchChipCube, p_rotation, p_zoomFactor, Isis::IException::Programmer, Isis::Chip::TackCube(), tackPointChanged(), Isis::IException::toString(), and Isis::IException::User.

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

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

Slot to rotate chip.

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

Definition at line 590 of file ChipViewport.cpp.

References autoStretch(), Isis::Chip::Load(), p_chip, p_chipCube, p_rotation, p_zoomFactor, and Isis::IException::toString().

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

Set chip.

Set the chip for this ChipViewport.

Author
Tracie Sucharski
History:
2009-14-2009 Tracie Sucharski - Make sure the p_image is clear before allocating new.

Definition at line 91 of file ChipViewport.cpp.

References _FILEINFO_, autoStretch(), chip(), Isis::Chip::Lines(), p_chip, p_chipCube, p_image, p_rotation, p_zoomFactor, Isis::IException::Programmer, Isis::Chip::Samples(), and tackPointChanged().

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

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 177 of file ChipViewport.h.

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

Slot to change state of crosshair.

Definition at line 487 of file ChipViewport.cpp.

References p_showPoints.

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

< Signal sent when tack point changes

Referenced by reloadChip(), and setChip().

double Isis::ChipViewport::tackSample ( )
void Isis::ChipViewport::zoom1 ( )
slot

Zoom by a factor of one.

Definition at line 397 of file ChipViewport.cpp.

References p_zoomFactor, and reloadChip().

double Isis::ChipViewport::zoomFactor ( )

Return the zoom factor.

Slot to refresh viewport , point has changed.

Definition at line 411 of file ChipViewport.cpp.

References p_zoomFactor.

Referenced by Isis::ControlPointEdit::setZoomLink(), and Isis::ControlPointEdit::updateLeftPositionLabel().

void Isis::ChipViewport::zoomIn ( )
slot

Zoom in.

Definition at line 375 of file ChipViewport.cpp.

References p_zoomFactor, and reloadChip().

void Isis::ChipViewport::zoomOut ( )
slot

Zoom out.

Definition at line 386 of file ChipViewport.cpp.

References p_zoomFactor, and reloadChip().

Member Data Documentation

Cube* Isis::ChipViewport::p_chipCube
private

The chip's cube.

Definition at line 218 of file ChipViewport.h.

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

bool Isis::ChipViewport::p_circle
private

Draw circle.

Definition at line 234 of file ChipViewport.h.

Referenced by ChipViewport(), and paintEvent().

int Isis::ChipViewport::p_circleSize
private

Circle size.

Definition at line 235 of file ChipViewport.h.

Referenced by paintEvent().

bool Isis::ChipViewport::p_cross
private

Draw crosshair.

Definition at line 233 of file ChipViewport.h.

Referenced by ChipViewport(), and paintEvent().

bool Isis::ChipViewport::p_geomIt
private

geomIt?

Definition at line 223 of file ChipViewport.h.

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

BandInfo Isis::ChipViewport::p_gray
private

info for the gray bands.

Definition at line 216 of file ChipViewport.h.

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

int Isis::ChipViewport::p_height
private

Chip height.

Definition at line 221 of file ChipViewport.h.

Referenced by ChipViewport(), and paintEvent().

QImage* Isis::ChipViewport::p_image
private

The image.

Definition at line 230 of file ChipViewport.h.

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

Chip* Isis::ChipViewport::p_matchChip
private

The matching chip.

Definition at line 224 of file ChipViewport.h.

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

Cube* Isis::ChipViewport::p_matchChipCube
private

The matching chip's cube.

Definition at line 225 of file ChipViewport.h.

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

bool Isis::ChipViewport::p_paintImage
private

Paint Image?

Definition at line 231 of file ChipViewport.h.

int Isis::ChipViewport::p_rotation
private

Rotation.

Definition at line 228 of file ChipViewport.h.

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

bool Isis::ChipViewport::p_showPoints
private

Draw control points.

Definition at line 232 of file ChipViewport.h.

Referenced by paintEvent(), and setPoints().

ChipViewport* Isis::ChipViewport::p_tempView
private

Temporary viewport.

Definition at line 237 of file ChipViewport.h.

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

int Isis::ChipViewport::p_width
private

Chip width.

Definition at line 220 of file ChipViewport.h.

Referenced by ChipViewport(), and paintEvent().

double Isis::ChipViewport::p_zoomFactor
private

Zoom Factor.

Definition at line 227 of file ChipViewport.h.

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


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