Isis 3 Programmer Reference
Isis::SawtoothStretchType Class Reference

This handles the advanced sawtooth stretch. More...

#include <SawtoothStretchType.h>

Inheritance diagram for Isis::SawtoothStretchType:
Inheritance graph
Collaboration diagram for Isis::SawtoothStretchType:
Collaboration graph

Signals

void saveToCube ()
 Emitted when a new Stretch object is available.
 
void deleteFromCube ()
 
void stretchChanged ()
 
void loadStretch ()
 

Public Member Functions

 SawtoothStretchType (const Histogram &, const Stretch &, const QString &name, const QColor &color)
 This initializes a sawtooth stretch type.
 
 ~SawtoothStretchType ()
 Destructor.
 
virtual CubeStretch getStretch ()
 Gets the CubeStretch for this Sawtooth Stretch.
 
virtual void setStretch (Stretch)
 Given an arbitrary stretch, this will re-interpret it, as best as possible, into a sawtooth stretch.
 
virtual void setHistogram (const Histogram &)
 This should be called when the visible area changes.
 

Protected Slots

void updateGraph ()
 This updates the graph with the current stretch object.
 
void updateTable ()
 This updates the table with the current stretch pairs.
 

Protected Member Functions

QTableWidget * createStretchTable ()
 This creates the stretch pairs table.
 

Protected Attributes

QGridLayout * p_mainLayout
 Main layout.
 
Histogramp_cubeHist
 Visible area histogram.
 
QTableWidget * p_table
 Pairs table.
 
HistogramWidgetp_graph
 Histogram graph.
 
Stretchp_stretch
 Current stretch pairs stored here.
 

Private Slots

void offsetSliderMoved (int)
 This is called when the sawtooth offset slider moves.
 
void offsetEditChanged (const QString &)
 This is called when the the sawtooth offset edit changes.
 
void widthSliderMoved (int)
 This is called when the sawtooth width slider moves.
 
void widthEditChanged (const QString &)
 This is called when the the sawtooth width edit changes.
 
void savePairs ()
 This asks the user for a file and saves the current stretch pairs to that file.
 

Private Member Functions

Stretch calculateNewStretch ()
 This calculates a new stretch using the GUI edits.
 
Stretch calculateNewStretch (double, double)
 This uses the parameters offset, width to create a sawtooth stretch.
 

Private Attributes

QSlider * p_offsetSlider
 Offset slider.
 
QLineEdit * p_offsetEdit
 Offset edit.
 
QSlider * p_widthSlider
 Width slider.
 
QLineEdit * p_widthEdit
 Width edit.
 
bool p_sliderOverride
 This is used to let the edits be changed to where sliders cant go.
 

Detailed Description

This handles the advanced sawtooth stretch.

The sawtooth stretch is useful for highlighting things like craters. This highlights areas of DNs - for example it can highlight all of the DNs based on how close to the mean they are (user guesses the mean from the histogram). It can also highlight DNs as they differ from the mean. Anyhow, it existed in a form before so this class was needed to encapsulate it. I'm not sure what the original request for this stretch type derived from.

Author
2010-05-20 Steven Lambright

Definition at line 33 of file SawtoothStretchType.h.

Constructor & Destructor Documentation

◆ SawtoothStretchType()

Isis::SawtoothStretchType::SawtoothStretchType ( const Histogram & hist,
const Stretch & stretch,
const QString & name,
const QColor & color )

◆ ~SawtoothStretchType()

Isis::SawtoothStretchType::~SawtoothStretchType ( )

Destructor.

Definition at line 87 of file SawtoothStretchType.cpp.

Member Function Documentation

◆ calculateNewStretch() [1/2]

Stretch Isis::SawtoothStretchType::calculateNewStretch ( )
private

This calculates a new stretch using the GUI edits.

Returns
Stretch

Definition at line 308 of file SawtoothStretchType.cpp.

References calculateNewStretch(), p_offsetEdit, and p_widthEdit.

Referenced by calculateNewStretch(), offsetEditChanged(), SawtoothStretchType(), setStretch(), and widthEditChanged().

◆ calculateNewStretch() [2/2]

Stretch Isis::SawtoothStretchType::calculateNewStretch ( double offset,
double width )
private

This uses the parameters offset, width to create a sawtooth stretch.

Parameters
offsetA pair mapping (offset, 0) will be created (or would if the histogram had the appropriate range)
widthHow wide the sawtooth is
Returns
Stretch

Definition at line 251 of file SawtoothStretchType.cpp.

References Isis::Stretch::AddPair(), Isis::Histogram::BinSize(), Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::StretchType::p_cubeHist, and Isis::toDouble().

◆ createStretchTable()

QTableWidget * Isis::StretchType::createStretchTable ( )
protectedinherited

This creates the stretch pairs table.

Returns
QTableWidget*

Definition at line 121 of file StretchType.cpp.

Referenced by Isis::StretchType::StretchType().

◆ getStretch()

CubeStretch Isis::SawtoothStretchType::getStretch ( )
virtual

Gets the CubeStretch for this Sawtooth Stretch.

Returns
CubeStretch

Reimplemented from Isis::StretchType.

Definition at line 319 of file SawtoothStretchType.cpp.

References Isis::StretchType::p_stretch.

◆ offsetEditChanged

void Isis::SawtoothStretchType::offsetEditChanged ( const QString & )
privateslot

This is called when the the sawtooth offset edit changes.

It updates the slider (while blocking the slider from calling this method again) and calculates a new stretch.

Definition at line 172 of file SawtoothStretchType.cpp.

References calculateNewStretch(), Isis::Stretch::CopyPairs(), Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::StretchType::p_cubeHist, p_offsetEdit, p_offsetSlider, p_sliderOverride, Isis::StretchType::p_stretch, and Isis::Stretch::Text().

Referenced by SawtoothStretchType(), and setStretch().

◆ offsetSliderMoved

void Isis::SawtoothStretchType::offsetSliderMoved ( int )
privateslot

This is called when the sawtooth offset slider moves.

It updates the edit.

Definition at line 153 of file SawtoothStretchType.cpp.

References Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::StretchType::p_cubeHist, p_offsetEdit, p_offsetSlider, p_sliderOverride, and p_widthSlider.

Referenced by SawtoothStretchType().

◆ savePairs

void Isis::StretchType::savePairs ( )
privateslotinherited

This asks the user for a file and saves the current stretch pairs to that file.

Definition at line 170 of file StretchType.cpp.

References Isis::StretchType::getStretch(), and Isis::Stretch::Text().

Referenced by Isis::StretchType::StretchType().

◆ saveToCube

void Isis::StretchType::saveToCube ( )
signalinherited

Emitted when a new Stretch object is available.

Referenced by Isis::StretchType::StretchType().

◆ setHistogram()

void Isis::StretchType::setHistogram ( const Histogram & hist)
virtualinherited

This should be called when the visible area changes.

It updates the graph and calls setStretch() so that the children have a chance to update their GUI elements too.

Parameters
hist

Definition at line 109 of file StretchType.cpp.

References Isis::StretchType::p_cubeHist, Isis::StretchType::p_graph, Isis::StretchType::p_stretch, Isis::HistogramWidget::setHistogram(), and Isis::StretchType::setStretch().

◆ setStretch()

void Isis::SawtoothStretchType::setStretch ( Stretch newStretch)
virtual

Given an arbitrary stretch, this will re-interpret it, as best as possible, into a sawtooth stretch.

It is required that a stretch that represents a sawtooth stretch always translate into itself and does not cause a stretchChanged(). To ensure this the sliders have been restricted to not be ambiguous.

It is necessary to always update slider positions in this method even if the stretch did not change.

Parameters
newStretchStretch to interpret

Implements Isis::StretchType.

Definition at line 104 of file SawtoothStretchType.cpp.

References Isis::Histogram::BinSize(), calculateNewStretch(), Isis::Stretch::CopyPairs(), offsetEditChanged(), Isis::StretchType::p_cubeHist, p_offsetEdit, Isis::StretchType::p_stretch, p_widthEdit, and widthEditChanged().

Referenced by SawtoothStretchType().

◆ updateGraph

void Isis::StretchType::updateGraph ( )
protectedslotinherited

This updates the graph with the current stretch object.

Definition at line 140 of file StretchType.cpp.

References Isis::StretchType::p_graph, Isis::StretchType::p_stretch, and Isis::HistogramWidget::setStretch().

Referenced by Isis::StretchType::StretchType().

◆ updateTable

void Isis::StretchType::updateTable ( )
protectedslotinherited

◆ widthEditChanged

void Isis::SawtoothStretchType::widthEditChanged ( const QString & )
privateslot

This is called when the the sawtooth width edit changes.

It updates the slider (while blocking the slider from calling this method again) and calculates a new stretch.

Definition at line 217 of file SawtoothStretchType.cpp.

References Isis::Histogram::BinSize(), calculateNewStretch(), Isis::Stretch::CopyPairs(), Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::StretchType::p_cubeHist, p_sliderOverride, Isis::StretchType::p_stretch, p_widthEdit, p_widthSlider, and Isis::Stretch::Text().

Referenced by SawtoothStretchType(), and setStretch().

◆ widthSliderMoved

void Isis::SawtoothStretchType::widthSliderMoved ( int )
privateslot

This is called when the sawtooth width slider moves.

It updates the edit.

Definition at line 197 of file SawtoothStretchType.cpp.

References Isis::Histogram::BinSize(), Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::StretchType::p_cubeHist, p_offsetSlider, p_sliderOverride, p_widthEdit, and p_widthSlider.

Referenced by SawtoothStretchType().

Member Data Documentation

◆ p_cubeHist

◆ p_graph

HistogramWidget* Isis::StretchType::p_graph
protectedinherited

◆ p_mainLayout

QGridLayout* Isis::StretchType::p_mainLayout
protectedinherited

◆ p_offsetEdit

QLineEdit* Isis::SawtoothStretchType::p_offsetEdit
private

◆ p_offsetSlider

QSlider* Isis::SawtoothStretchType::p_offsetSlider
private

Offset slider.

Definition at line 55 of file SawtoothStretchType.h.

Referenced by offsetEditChanged(), offsetSliderMoved(), SawtoothStretchType(), and widthSliderMoved().

◆ p_sliderOverride

bool Isis::SawtoothStretchType::p_sliderOverride
private

This is used to let the edits be changed to where sliders cant go.

Definition at line 61 of file SawtoothStretchType.h.

Referenced by offsetEditChanged(), offsetSliderMoved(), SawtoothStretchType(), widthEditChanged(), and widthSliderMoved().

◆ p_stretch

◆ p_table

◆ p_widthEdit

QLineEdit* Isis::SawtoothStretchType::p_widthEdit
private

◆ p_widthSlider

QSlider* Isis::SawtoothStretchType::p_widthSlider
private

Width slider.

Definition at line 57 of file SawtoothStretchType.h.

Referenced by offsetSliderMoved(), SawtoothStretchType(), widthEditChanged(), and widthSliderMoved().


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