Isis 3 Programmer Reference
Isis::ZoomTool Class Reference

Handles zoom operations for Isis qt apps. More...

#include <ZoomTool.h>

Inheritance diagram for Isis::ZoomTool:
Inheritance graph
Collaboration diagram for Isis::ZoomTool:
Collaboration graph

Public Slots

void activate (bool)
 Activates the tool. More...
 
void setCubeViewport (MdiCubeViewport *cvp)
 Sets the current viewport to the given cvp. More...
 

Signals

void clearWarningSignal ()
 
void toolActivated ()
 
void viewportChanged ()
 

Public Member Functions

 ZoomTool (QWidget *parent)
 ZoomTool constructor. More...
 
void addTo (QMenu *menu)
 Adds the zoom action to the given menu. More...
 
QString menuName () const
 
void addTo (ViewportMainWindow *mw)
 Adds the tool to the application. More...
 
void addTo (ToolPad *toolpad)
 Adds the tool to the toolpad. More...
 
virtual void addTo (Workspace *ws)
 Adds the given workspace to the cubeviewport list. More...
 
virtual void addToPermanent (QToolBar *toolbar)
 
void addToActive (QToolBar *toolbar)
 
QString toolIconDir () const
 returns the path to the icon directory. More...
 
virtual void paintViewport (MdiCubeViewport *vp, QPainter *painter)
 
RubberBandToolrubberBandTool ()
 
void setList (ToolList *currentList)
 

Protected Types

typedef QVector< MdiCubeViewport * > CubeViewportList
 A list of cubeviewports. More...
 

Protected Slots

void rubberBandComplete ()
 This method is called when the RubberBandTool is complete. More...
 
virtual void screenPixelsChanged ()
 This is called when actions change which pixels from the cube are displayed. More...
 
virtual void mouseEnter ()
 
virtual void mouseMove (QPoint p)
 
virtual void mouseMove (QPoint p, Qt::MouseButton)
 
virtual void mouseLeave ()
 

Protected Member Functions

QActiontoolPadAction (ToolPad *toolpad)
 Adds the action to the toolpad. More...
 
void updateTool ()
 This method updates the line edits text to the correct zoom value. More...
 
QWidgetcreateToolBarWidget (QStackedWidget *parent)
 Creates the widget to add to the tool bar. More...
 
void enableRubberBandTool ()
 This methods enables the RubberBandTool, it also sets the RubberBandTool to allow points and to allow all clicks. More...
 
virtual void mouseDoubleClick (QPoint p)
 
virtual void mouseButtonPress (QPoint p, Qt::MouseButton s)
 
virtual void mouseButtonRelease (QPoint p, Qt::MouseButton s)
 Resets the Warning to Nowarning when a different activity occurs on the application. More...
 
virtual void updateMeasure ()
 
virtual void scaleChanged ()
 
virtual void stretchRequested (MdiCubeViewport *, int)
 
void registerTool (MdiCubeViewport *viewport)
 Registers the tool to the viewport. More...
 
MdiCubeViewportcubeViewport () const
 Return the current cubeviewport. More...
 
CubeViewportListcubeViewportList () const
 Return the list of cubeviewports. More...
 
virtual void addConnections (MdiCubeViewport *cvp)
 Anytime a tool is created, you must add the connections for it. More...
 
virtual void removeConnections (MdiCubeViewport *cvp)
 Anytime a tool is created, you must be able to remove it's connections. More...
 
Workspaceworkspace ()
 

Private Slots

void zoomIn2X ()
 Zooms in 2 times. More...
 
void zoomIn4X ()
 Zooms in 4 times. More...
 
void zoomIn8X ()
 Zooms in 8 times. More...
 
void zoomOut2X ()
 Zoom out 2 times. More...
 
void zoomOut4X ()
 Zoom out 4 times. More...
 
void zoomOut8X ()
 Zoom out 8 times. More...
 
void zoomActual ()
 Zoom back to 1 to 1. More...
 
void zoomFit ()
 Fits the cube in the viewport. More...
 
void zoomFitWidth ()
 Slot for the "Fit to Width" menu item on the Fit button. More...
 
void zoomFitHeight ()
 Slot for the "Fit to Heighth" menu item on the Fit button. More...
 
void zoomManual ()
 This method zooms by the value input in the line edit next to the zoom tools. More...
 
double setScale (MdiCubeViewport *d, double newScale)
 This method will attempt to reset the scale for the given MdiCubeViewport using the new scale value. More...
 
double setScale (MdiCubeViewport *d, double newScale, int x, int y)
 This method will attempt to reset the scale for the given MdiCubeViewport at the x, y values using the new scale value. More...
 
double setScale (MdiCubeViewport *d, double newScale, double samp, double line)
 This method will attempt to reset the scale for the given MdiCubeViewport at the x, y values using the new scale value. More...
 

Private Member Functions

void zoomBy (double factor)
 Zoom by the given factor. More...
 
void addViewportConnections ()
 Makes all the connections for the tool. More...
 
void removeViewportConnections ()
 Removes all the connections from the tool. More...
 
void enableToolBar ()
 Enables entire tool bar. More...
 
void disableToolBar ()
 Disables entire tool bar. More...
 

Private Attributes

QActionp_zoomIn2X
 Zoom in 2 times. More...
 
QActionp_zoomIn4X
 Zoom in 4 times. More...
 
QActionp_zoomIn8X
 Zoom in 8 times. More...
 
QActionp_zoomOut2X
 Zoom out 2 times. More...
 
QActionp_zoomOut4X
 Zoom out 4 times. More...
 
QActionp_zoomOut8X
 Zoom out 8 times. More...
 
QActionp_zoomActual
 Zoom to actual size action. More...
 
QActionp_zoomFit
 Fit the cube in the viewport action. More...
 
QLineEdit * p_zoomLineEdit
 Line edit for manual zoom factor. More...
 
double p_lastScale
 Last scale. More...
 
MdiCubeViewportm_cvp
 current cubeviewport More...
 
Workspacem_workspace
 
bool m_active
 Is the tool acitve? More...
 
QWidgetm_toolBarWidget
 The tool bar on which this tool resides. More...
 
QActionm_toolPadAction
 The tool pad on which this tool resides. More...
 
QString m_toolIconDir
 The pathway to the icon directory. More...
 
ToolListm_toolList
 

Detailed Description

Handles zoom operations for Isis qt apps.

Author
????-??-?? Jeff Anderson - ???
History:
2007-03-21 Tracie Sucharski - Added zoomFitWidth and zoomFitHeight slots and changed the zoomFit button to contain a popup menu for "Fit to Width" & "Fit to Height".
History:
2008-05-23 Noah Hilt - Added RubberBandTool functionality and changed the mouseButtonReleased Method.
History:
2009-02-12 Steven Lambright - Fixed zooming in/out with rectangle rubber band
History:
2010-06-26 Eric Hyer - Now uses MdiCubeViewport instead of CubeViewport. Fixed some include issues.
History:
2010-07-12 Jeannie Walldren - Created setScale() methods to display a QMessageBox if a scale value could not be set.
History:
2010-07-14 Jeannie Walldren - Fixed bug that caused 1:1 to fail. Added iExceptions if value is manually entered in text box is invalid. Updated documentation.
History:
2010-12-22 Eric Hyer - Removed mouseButtonPress method.
History:
2011-09-28 Steven Lambright - Removed p_userCursor. It was only causing bugs. As a result, the mouseButtonRelease method did nothing so I removed that too. Zooming happens on the rubberBandComplete slot.
History:
2017-05-10 Ian Humphrey - Modified zoomFit() so that when doing a "Fit in viewport" zoom, the image is centered properly in the viewport. Fixes #4756.

Definition at line 56 of file ZoomTool.h.

Member Typedef Documentation

◆ CubeViewportList

typedef QVector< MdiCubeViewport * > Isis::Tool::CubeViewportList
protectedinherited

A list of cubeviewports.

Definition at line 205 of file Tool.h.

Constructor & Destructor Documentation

◆ ZoomTool()

Isis::ZoomTool::ZoomTool ( QWidget parent)

Member Function Documentation

◆ activate

◆ addConnections()

virtual void Isis::Tool::addConnections ( MdiCubeViewport cvp)
inlineprotectedvirtualinherited

Anytime a tool is created, you must add the connections for it.

Parameters
cvp

Reimplemented in Isis::WindowTool, and Isis::TrackTool.

Definition at line 239 of file Tool.h.

Referenced by Isis::Tool::addViewportConnections().

◆ addTo() [1/4]

void Isis::ZoomTool::addTo ( QMenu menu)
virtual

Adds the zoom action to the given menu.

This will include the Zoom In (by factor of 2), Zoom Out (by factor of 1/2), Zoom Actual (1:1) and Zoom Fit actions.

Parameters
menuPointer to the QMenu

Reimplemented from Isis::Tool.

Definition at line 117 of file ZoomTool.cpp.

References p_zoomActual, p_zoomFit, p_zoomIn2X, and p_zoomOut2X.

◆ addTo() [2/4]

void Isis::Tool::addTo ( ToolPad toolpad)
inherited

Adds the tool to the toolpad.

Parameters
toolpad

Definition at line 98 of file Tool.cpp.

References Isis::Tool::activate(), Isis::ToolPad::addAction(), Isis::Tool::m_toolPadAction, and Isis::Tool::toolPadAction().

◆ addTo() [3/4]

◆ addTo() [4/4]

void Isis::Tool::addTo ( Workspace ws)
virtualinherited

Adds the given workspace to the cubeviewport list.

Parameters
ws

Reimplemented in Isis::WindowTool, Isis::SpecialPixelTool, Isis::FileTool, and Isis::EditTool.

Definition at line 45 of file Tool.cpp.

References Isis::Tool::registerTool(), and Isis::Tool::setCubeViewport().

◆ addToActive()

void Isis::Tool::addToActive ( QToolBar toolbar)
inherited

◆ addToPermanent()

virtual void Isis::Tool::addToPermanent ( QToolBar toolbar)
inlinevirtualinherited

◆ addViewportConnections()

◆ createToolBarWidget()

QWidget * Isis::ZoomTool::createToolBarWidget ( QStackedWidget *  parent)
protectedvirtual

Creates the widget to add to the tool bar.

For each button, this method assigns the icons, ToolTips, WhatsThis, and connects a slot to the clicked signal. The following buttons are included

  • Zoom In - uses the magnifying glass with "+" icon and shortcut +
  • Zoom Out - uses the magnifying glass with "-" icon and shortcut -
  • Zoom 1:1 - uses the magnifying glass with "1:1" icon and shortcut /
  • Fit in viewport - uses the magnifying glass with "dotted square" icon, shortcut * and drop down menu to choose to "Fit Width" or "Fit Height"
  • Scale - Text box to manually enter scale
Parameters
parentParent stacked widget
Returns
QWidget* Horizontal box to which the zoom tools icons will be added

Reimplemented from Isis::Tool.

Definition at line 143 of file ZoomTool.cpp.

References p_zoomLineEdit, Isis::Tool::toolIconDir(), zoomActual(), zoomFit(), zoomFitHeight(), zoomFitWidth(), zoomIn2X(), zoomManual(), and zoomOut2X().

◆ cubeViewport()

MdiCubeViewport* Isis::Tool::cubeViewport ( ) const
inlineprotectedinherited

Return the current cubeviewport.

Returns
CubeViewport*

Definition at line 197 of file Tool.h.

References Isis::Tool::m_cvp.

Referenced by Isis::TrackTool::addConnections(), Isis::WindowTool::addConnections(), Isis::StretchTool::advancedStretchChanged(), Isis::FindTool::centerLinkedViewports(), Isis::StretchTool::changeStretch(), Isis::BandTool::changeView(), Isis::BandTool::copyLinkedViewports(), Isis::StretchTool::deleteFromCube(), Isis::FileTool::discard(), Isis::Tool::enableToolBar(), Isis::FileTool::exportToList(), Isis::FileTool::exportView(), Isis::StatisticsTool::getStatistics(), Isis::FindTool::handleRecordClicked(), Isis::EditTool::LineToPoints(), Isis::StretchTool::loadStretchFromCube(), Isis::TrackTool::locateCursor(), Isis::SunShadowTool::mouseButtonPress(), Isis::EditTool::mouseButtonRelease(), Isis::ControlNetTool::mouseButtonRelease(), Isis::FeatureNomenclatureTool::mouseButtonRelease(), Isis::FindTool::mouseButtonRelease(), Isis::MatchTool::mouseButtonRelease(), Isis::QnetTool::mouseButtonRelease(), Isis::RubberBandTool::mouseButtonRelease(), Isis::StretchTool::mouseButtonRelease(), Isis::AdvancedTrackTool::mouseLeave(), Isis::SunShadowTool::mouseMove(), Isis::TrackTool::mouseMove(), Isis::RubberBandTool::mouseMove(), Isis::ScatterPlotTool::mouseMove(), Isis::FindTool::paintViewport(), Isis::RubberBandTool::paintViewport(), Isis::SunShadowTool::paintViewport(), Isis::FileTool::print(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::EditTool::redoEdit(), Isis::FindTool::refresh(), Isis::HistogramTool::refreshPlot(), Isis::SpatialPlotTool::refreshPlot(), Isis::SpectralPlotTool::refreshPlot(), Isis::TrackTool::removeConnections(), Isis::WindowTool::removeConnections(), Isis::RubberBandTool::repaint(), Isis::WindowTool::resizeWindows(), Isis::EditTool::rubberBandComplete(), Isis::HistogramTool::rubberBandComplete(), Isis::MeasureTool::rubberBandComplete(), Isis::StretchTool::rubberBandComplete(), rubberBandComplete(), Isis::FileTool::save(), Isis::FileTool::saveAs(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsReducedCube(), Isis::FileTool::saveInfo(), Isis::StretchTool::saveStretchToCube(), Isis::BandTool::setBandBin(), Isis::BandTool::setList(), Isis::StretchTool::setStretchAcrossBands(), Isis::StretchTool::setStretchAllViewports(), Isis::StretchTool::showAdvancedDialog(), Isis::ScatterPlotTool::showNewScatterPlotConfig(), Isis::StretchTool::stretchChanged(), Isis::StretchTool::stretchGlobal(), Isis::StretchTool::stretchGlobalAllBands(), Isis::StretchTool::stretchRegional(), Isis::EditTool::undoEdit(), Isis::StretchTool::updateAdvStretchDialogforAll(), Isis::StretchTool::updateHistograms(), Isis::TrackTool::updateLabels(), Isis::MeasureTool::updateMeasure(), Isis::AdvancedTrackTool::updateRow(), Isis::AbstractPlotTool::updateTool(), Isis::BandTool::updateTool(), Isis::BlinkTool::updateTool(), Isis::EditTool::updateTool(), Isis::FileTool::updateTool(), Isis::FindTool::updateTool(), Isis::SpecialPixelTool::updateTool(), Isis::StretchTool::updateTool(), Isis::SunShadowTool::updateTool(), Isis::WindowTool::updateTool(), updateTool(), Isis::AbstractPlotTool::viewportsToPlot(), Isis::EditTool::writeToCube(), zoomBy(), zoomFit(), zoomFitHeight(), zoomFitWidth(), and zoomManual().

◆ cubeViewportList()

Tool::CubeViewportList * Isis::Tool::cubeViewportList ( ) const
protectedinherited

Return the list of cubeviewports.

Returns
CubeViewportList*

Definition at line 390 of file Tool.cpp.

References Isis::Workspace::cubeViewportList().

Referenced by Isis::BlinkTool::advance(), Isis::SpecialPixelTool::apply(), Isis::FindTool::centerLinkedViewports(), Isis::WindowTool::changeCursor(), Isis::FileTool::closeAll(), Isis::BandTool::copyAllViewports(), Isis::BandTool::copyLinkedViewports(), Isis::MatchTool::createPoint(), Isis::BlinkTool::eventFilter(), Isis::FeatureNomenclatureTool::featuresIdentified(), Isis::FeatureNomenclatureTool::findMissingNomenclature(), Isis::FeatureNomenclatureTool::findNomenclatureStateChanged(), Isis::FindTool::handleLinkClicked(), Isis::WindowTool::linkWindows(), Isis::RubberBandTool::mouseButtonRelease(), Isis::RubberBandTool::mouseMove(), Isis::QnetTool::openGround(), Isis::ControlNetTool::paintAllViewports(), Isis::MatchTool::paintAllViewports(), Isis::StereoTool::paintAllViewports(), Isis::QnetTool::paintAllViewports(), Isis::FindTool::refresh(), Isis::ScatterPlotTool::repaintViewports(), Isis::AbstractPlotTool::repaintViewports(), Isis::WindowTool::resizeWindows(), Isis::BlinkTool::reverse(), rubberBandComplete(), Isis::MatchTool::serialNumberList(), Isis::ControlNetTool::setControlNet(), Isis::FeatureNomenclatureTool::setFontColor(), Isis::FeatureNomenclatureTool::setFontSize(), Isis::FeatureNomenclatureTool::setShowApprovedOnly(), Isis::StretchTool::setStretchAllViewports(), Isis::FeatureNomenclatureTool::setVectorType(), Isis::StretchTool::stretchGlobalAllViewports(), Isis::BlinkTool::toggleLink(), Isis::WindowTool::unlinkWindows(), Isis::MeasureTool::updateMeasure(), Isis::AdvancedTrackTool::updateRow(), Isis::BlinkTool::updateTool(), Isis::FindTool::updateTool(), Isis::WindowTool::updateTool(), Isis::AbstractPlotTool::viewportsToPlot(), zoomBy(), zoomFit(), zoomFitHeight(), zoomFitWidth(), and zoomManual().

◆ disableToolBar()

void Isis::Tool::disableToolBar ( )
privateinherited

Disables entire tool bar.

Definition at line 285 of file Tool.cpp.

References Isis::Tool::m_toolBarWidget.

Referenced by Isis::Tool::activate(), and Isis::Tool::addToActive().

◆ enableRubberBandTool()

void Isis::ZoomTool::enableRubberBandTool ( )
protectedvirtual

This methods enables the RubberBandTool, it also sets the RubberBandTool to allow points and to allow all clicks.

Reimplemented from Isis::Tool.

Definition at line 590 of file ZoomTool.cpp.

References Isis::RubberBandTool::enable(), and Isis::RubberBandTool::setDrawActiveViewportOnly().

◆ enableToolBar()

void Isis::Tool::enableToolBar ( )
privateinherited

Enables entire tool bar.

Definition at line 297 of file Tool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::m_toolBarWidget, and Isis::Tool::updateTool().

Referenced by Isis::Tool::activate(), and Isis::Tool::setCubeViewport().

◆ menuName()

QString Isis::ZoomTool::menuName ( ) const
inlinevirtual
Returns
the name of the menu.

Reimplemented from Isis::Tool.

Definition at line 66 of file ZoomTool.h.

◆ mouseButtonPress()

void Isis::Tool::mouseButtonPress ( QPoint  p,
Qt::MouseButton  s 
)
protectedvirtualinherited
Parameters
p
s

Definition at line 367 of file Tool.cpp.

Referenced by Isis::Tool::addViewportConnections(), and Isis::Tool::removeViewportConnections().

◆ mouseButtonRelease()

void Isis::Tool::mouseButtonRelease ( QPoint  p,
Qt::MouseButton  s 
)
protectedvirtualinherited

Resets the Warning to Nowarning when a different activity occurs on the application.

This is called by all the mouseButtonRelease events in all the tools.

Parameters
p
s

Reimplemented in Isis::FeatureNomenclatureTool.

Definition at line 380 of file Tool.cpp.

Referenced by Isis::Tool::addViewportConnections(), Isis::StretchTool::mouseButtonRelease(), and Isis::Tool::removeViewportConnections().

◆ mouseDoubleClick()

void Isis::Tool::mouseDoubleClick ( QPoint  p)
protectedvirtualinherited
Parameters
p

Definition at line 358 of file Tool.cpp.

Referenced by Isis::Tool::addViewportConnections(), and Isis::Tool::removeViewportConnections().

◆ mouseMove

void Isis::Tool::mouseMove ( QPoint  p)
protectedvirtualslotinherited
Parameters
p

Definition at line 352 of file Tool.cpp.

Referenced by Isis::Tool::addViewportConnections(), and Isis::Tool::removeViewportConnections().

◆ paintViewport()

virtual void Isis::Tool::paintViewport ( MdiCubeViewport vp,
QPainter *  painter 
)
inlinevirtualinherited

◆ registerTool()

void Isis::Tool::registerTool ( MdiCubeViewport viewport)
protectedinherited

Registers the tool to the viewport.

Parameters
viewport

Definition at line 327 of file Tool.cpp.

References Isis::Tool::m_cvp, and Isis::MdiCubeViewport::registerTool().

Referenced by Isis::Tool::addTo().

◆ removeConnections()

virtual void Isis::Tool::removeConnections ( MdiCubeViewport cvp)
inlineprotectedvirtualinherited

Anytime a tool is created, you must be able to remove it's connections.

Parameters
cvp

Reimplemented in Isis::WindowTool, Isis::TrackTool, and Isis::MeasureTool.

Definition at line 247 of file Tool.h.

Referenced by Isis::Tool::removeViewportConnections().

◆ removeViewportConnections()

void Isis::Tool::removeViewportConnections ( )
privateinherited

◆ rubberBandComplete

void Isis::ZoomTool::rubberBandComplete ( )
protectedslot

This method is called when the RubberBandTool is complete.

It will either zoom the CubeViewport to the rectangle specified by the RubberBandTool or will handle different zoom methods specified by the last RubberBandTool's mouse button.

History:
2010-07-12 Jeannie Walldren - Modified to call this object's setScale method.
History:
2010-07-12 Jeannie Walldren - Replaced checks for newScale==0 accidentally removed in previous commit.

Definition at line 496 of file ZoomTool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), Isis::MdiCubeViewport::isLinked(), Isis::RubberBandTool::mouseButton(), p_lastScale, Isis::RubberBandTool::rectangle(), Isis::CubeViewport::scale(), setScale(), updateTool(), and Isis::RubberBandTool::vertices().

◆ screenPixelsChanged

virtual void Isis::Tool::screenPixelsChanged ( )
inlineprotectedvirtualslotinherited

This is called when actions change which pixels from the cube are displayed.

Definition at line 148 of file Tool.h.

Referenced by Isis::Tool::addViewportConnections(), Isis::Tool::removeViewportConnections(), and Isis::FeatureNomenclatureTool::viewportDone().

◆ setCubeViewport

void Isis::Tool::setCubeViewport ( MdiCubeViewport cvp)
slotinherited

◆ setScale [1/3]

double Isis::ZoomTool::setScale ( MdiCubeViewport d,
double  newScale 
)
privateslot

This method will attempt to reset the scale for the given MdiCubeViewport using the new scale value.

If this fails, a message box will pop up.

Parameters
dPointer to MdiCubeViewport
newScaleNew scale value of the cube
Returns
double The scale value used. If the passed in value fails, this will be the previous scale value.
Exceptions
iException::User"Scale value must be greater than 0."
iException::User"Unable to rescale image."
Author
Jeannie Walldren
History:
2010-07-12 Jeannie Walldren - Original version.
History:
2010-07-14 Jeannie Walldren - Added error message if the new scale value is less than or equal to 0.

Definition at line 614 of file ZoomTool.cpp.

References Isis::CubeViewport::scale(), Isis::CubeViewport::setScale(), Isis::IException::toString(), and Isis::IException::User.

Referenced by rubberBandComplete(), zoomBy(), zoomFit(), zoomFitHeight(), zoomFitWidth(), and zoomManual().

◆ setScale [2/3]

double Isis::ZoomTool::setScale ( MdiCubeViewport d,
double  newScale,
double  samp,
double  line 
)
privateslot

This method will attempt to reset the scale for the given MdiCubeViewport at the x, y values using the new scale value.

If this fails, a message box will pop up.

Parameters
dPointer to MdiCubeViewport
newScaleNew scale value of the cube
samp
line
Returns
double The scale value used. If the passed in value fails, this will be the previous scale value.
Exceptions
iException::User"Scale value must be greater than 0."
iException::User"Unable to rescale image."
Author
Jeannie Walldren
History:
2010-07-12 Jeannie Walldren - Original version.
History:
2010-07-14 Jeannie Walldren - Added error message if the new scale value is less than or equal to 0.

Definition at line 702 of file ZoomTool.cpp.

References Isis::CubeViewport::scale(), Isis::CubeViewport::setScale(), Isis::IException::toString(), and Isis::IException::User.

◆ setScale [3/3]

double Isis::ZoomTool::setScale ( MdiCubeViewport d,
double  newScale,
int  x,
int  y 
)
privateslot

This method will attempt to reset the scale for the given MdiCubeViewport at the x, y values using the new scale value.

If this fails, a message box will pop up.

Parameters
dPointer to MdiCubeViewport
newScaleNew scale value of the cube
x
y
Returns
double The scale value used. If the passed in value fails, this will be the previous scale value.
Exceptions
iException::User"Scale value must be greater than 0."
iException::User"Unable to rescale image."
Author
Jeannie Walldren
History:
2010-07-12 Jeannie Walldren - Original version.
History:
2010-07-14 Jeannie Walldren - Added error message if the new scale value is less than or equal to 0.

Definition at line 660 of file ZoomTool.cpp.

References Isis::CubeViewport::scale(), Isis::CubeViewport::setScale(), Isis::IException::toString(), and Isis::IException::User.

◆ toolIconDir()

QString Isis::Tool::toolIconDir ( ) const
inlineinherited

◆ toolPadAction()

QAction * Isis::ZoomTool::toolPadAction ( ToolPad toolpad)
protectedvirtual

Adds the action to the toolpad.

The icon used will be the magnifying glass. The tool tip reads "Zoom (Z)" with shortcut key "Z".

Parameters
toolpadToolpad to which the zoom tool will be added
Returns
QAction* ZoomTool action defined by the cursor, ToolTip,

Reimplemented from Isis::Tool.

Definition at line 96 of file ZoomTool.cpp.

References Isis::Tool::toolIconDir().

◆ updateTool()

void Isis::ZoomTool::updateTool ( )
protectedvirtual

This method updates the line edits text to the correct zoom value.

Reimplemented from Isis::Tool.

Definition at line 471 of file ZoomTool.cpp.

References Isis::Tool::cubeViewport(), p_zoomLineEdit, and Isis::CubeViewport::scale().

Referenced by rubberBandComplete(), zoomBy(), zoomFit(), zoomFitHeight(), zoomFitWidth(), and zoomManual().

◆ zoomActual

void Isis::ZoomTool::zoomActual ( )
privateslot

Zoom back to 1 to 1.

Definition at line 312 of file ZoomTool.cpp.

References zoomBy().

Referenced by createToolBarWidget(), and ZoomTool().

◆ zoomBy()

void Isis::ZoomTool::zoomBy ( double  factor)
private

Zoom by the given factor.

Parameters
factorZoom factor value
History:
2010-07-12 Jeannie Walldren - Modified to call this object's setScale method.
History:
2010-07-12 Jeannie Walldren - Replaced checks for newScale==0 accidentally removed in previous commit.

Definition at line 330 of file ZoomTool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), Isis::MdiCubeViewport::isLinked(), Isis::CubeViewport::scale(), setScale(), and updateTool().

Referenced by zoomActual(), zoomIn2X(), zoomIn4X(), zoomIn8X(), zoomOut2X(), zoomOut4X(), and zoomOut8X().

◆ zoomFit

void Isis::ZoomTool::zoomFit ( )
privateslot

Fits the cube in the viewport.

History:
2010-07-12 Jeannie Walldren - Modified to call this object's setScale method.
History:
2017-05-10 Ian Humphrey - Modified so that the setScale() is accommodating the ISIS pixel center definition (integer center) (+0.5). References #4756.

Definition at line 368 of file ZoomTool.cpp.

References Isis::CubeViewport::cubeLines(), Isis::CubeViewport::cubeSamples(), Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), Isis::CubeViewport::fitScale(), Isis::MdiCubeViewport::isLinked(), setScale(), and updateTool().

Referenced by createToolBarWidget(), and ZoomTool().

◆ zoomFitHeight

void Isis::ZoomTool::zoomFitHeight ( )
privateslot

Slot for the "Fit to Heighth" menu item on the Fit button.

This will display the cube so that the entire cube heighth is displayed.

History:
2010-07-12 Jeannie Walldren - Modified to call this object's setScale method.

Definition at line 420 of file ZoomTool.cpp.

References Isis::CubeViewport::cubeLines(), Isis::CubeViewport::cubeSamples(), Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), Isis::CubeViewport::fitScaleHeight(), Isis::MdiCubeViewport::isLinked(), setScale(), and updateTool().

Referenced by createToolBarWidget().

◆ zoomFitWidth

void Isis::ZoomTool::zoomFitWidth ( )
privateslot

Slot for the "Fit to Width" menu item on the Fit button.

This will display the cube so that the entire cube width is displayed.

History:
2010-07-12 Jeannie Walldren - Modified to call this object's setScale method.

Definition at line 394 of file ZoomTool.cpp.

References Isis::CubeViewport::cubeLines(), Isis::CubeViewport::cubeSamples(), Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), Isis::CubeViewport::fitScaleWidth(), Isis::MdiCubeViewport::isLinked(), setScale(), and updateTool().

Referenced by createToolBarWidget().

◆ zoomIn2X

void Isis::ZoomTool::zoomIn2X ( )
privateslot

Zooms in 2 times.

Definition at line 258 of file ZoomTool.cpp.

References zoomBy().

Referenced by createToolBarWidget(), and ZoomTool().

◆ zoomIn4X

void Isis::ZoomTool::zoomIn4X ( )
privateslot

Zooms in 4 times.

Definition at line 267 of file ZoomTool.cpp.

References zoomBy().

Referenced by ZoomTool().

◆ zoomIn8X

void Isis::ZoomTool::zoomIn8X ( )
privateslot

Zooms in 8 times.

Definition at line 276 of file ZoomTool.cpp.

References zoomBy().

Referenced by ZoomTool().

◆ zoomManual

void Isis::ZoomTool::zoomManual ( )
privateslot

This method zooms by the value input in the line edit next to the zoom tools.

History:
2010-07-12 Jeannie Walldren - Modified to call this object's setScale method.

Definition at line 447 of file ZoomTool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), Isis::MdiCubeViewport::isLinked(), p_zoomLineEdit, setScale(), and updateTool().

Referenced by createToolBarWidget().

◆ zoomOut2X

void Isis::ZoomTool::zoomOut2X ( )
privateslot

Zoom out 2 times.

Definition at line 285 of file ZoomTool.cpp.

References zoomBy().

Referenced by createToolBarWidget(), and ZoomTool().

◆ zoomOut4X

void Isis::ZoomTool::zoomOut4X ( )
privateslot

Zoom out 4 times.

Definition at line 294 of file ZoomTool.cpp.

References zoomBy().

Referenced by ZoomTool().

◆ zoomOut8X

void Isis::ZoomTool::zoomOut8X ( )
privateslot

Zoom out 8 times.

Definition at line 303 of file ZoomTool.cpp.

References zoomBy().

Referenced by ZoomTool().

Member Data Documentation

◆ m_active

bool Isis::Tool::m_active
privateinherited

Is the tool acitve?

Definition at line 264 of file Tool.h.

Referenced by Isis::Tool::activate(), Isis::Tool::setCubeViewport(), and Isis::Tool::Tool().

◆ m_cvp

◆ m_toolBarWidget

QWidget* Isis::Tool::m_toolBarWidget
privateinherited

The tool bar on which this tool resides.

Definition at line 265 of file Tool.h.

Referenced by Isis::Tool::addToActive(), Isis::Tool::disableToolBar(), Isis::Tool::enableToolBar(), and Isis::Tool::Tool().

◆ m_toolIconDir

QString Isis::Tool::m_toolIconDir
privateinherited

The pathway to the icon directory.

Definition at line 267 of file Tool.h.

Referenced by Isis::Tool::Tool(), and Isis::Tool::toolIconDir().

◆ m_toolPadAction

QAction* Isis::Tool::m_toolPadAction
privateinherited

The tool pad on which this tool resides.

Definition at line 266 of file Tool.h.

Referenced by Isis::Tool::activate(), Isis::Tool::addTo(), Isis::Tool::addViewportConnections(), and Isis::Tool::Tool().

◆ p_lastScale

double Isis::ZoomTool::p_lastScale
private

Last scale.

Definition at line 114 of file ZoomTool.h.

Referenced by rubberBandComplete().

◆ p_zoomActual

QAction* Isis::ZoomTool::p_zoomActual
private

Zoom to actual size action.

Definition at line 110 of file ZoomTool.h.

Referenced by addTo(), and ZoomTool().

◆ p_zoomFit

QAction* Isis::ZoomTool::p_zoomFit
private

Fit the cube in the viewport action.

Definition at line 111 of file ZoomTool.h.

Referenced by addTo(), and ZoomTool().

◆ p_zoomIn2X

QAction* Isis::ZoomTool::p_zoomIn2X
private

Zoom in 2 times.

Definition at line 102 of file ZoomTool.h.

Referenced by addTo(), and ZoomTool().

◆ p_zoomIn4X

QAction* Isis::ZoomTool::p_zoomIn4X
private

Zoom in 4 times.

Definition at line 103 of file ZoomTool.h.

Referenced by ZoomTool().

◆ p_zoomIn8X

QAction* Isis::ZoomTool::p_zoomIn8X
private

Zoom in 8 times.

Definition at line 104 of file ZoomTool.h.

Referenced by ZoomTool().

◆ p_zoomLineEdit

QLineEdit* Isis::ZoomTool::p_zoomLineEdit
private

Line edit for manual zoom factor.

Definition at line 113 of file ZoomTool.h.

Referenced by createToolBarWidget(), updateTool(), and zoomManual().

◆ p_zoomOut2X

QAction* Isis::ZoomTool::p_zoomOut2X
private

Zoom out 2 times.

Definition at line 106 of file ZoomTool.h.

Referenced by addTo(), and ZoomTool().

◆ p_zoomOut4X

QAction* Isis::ZoomTool::p_zoomOut4X
private

Zoom out 4 times.

Definition at line 107 of file ZoomTool.h.

Referenced by ZoomTool().

◆ p_zoomOut8X

QAction* Isis::ZoomTool::p_zoomOut8X
private

Zoom out 8 times.

Definition at line 108 of file ZoomTool.h.

Referenced by ZoomTool().


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