USGS

Isis 3.0 Object Programmers' Reference

Home

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 stretchChanged ()
 Emitted when a new Stretch object is available.
 

Public Member Functions

 SawtoothStretchType (const Histogram &, const Stretch &, const QString &name, const QColor &color)
 This initializes a sawtooth stretch type.
 
 ~SawtoothStretchType ()
 Destructor.
 
virtual void setStretch (Stretch)
 Given an arbitrary stretch, this will re-interpret it, as best as possible, into a sawtooth stretch.
 
virtual Stretch getStretch ()
 Returns the current stretch object.
 
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.
 

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 32 of file SawtoothStretchType.h.

Constructor & Destructor Documentation

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

Destructor.

Definition at line 86 of file SawtoothStretchType.cpp.

Member Function Documentation

Stretch Isis::SawtoothStretchType::calculateNewStretch ( )
private

This calculates a new stretch using the GUI edits.

Returns
Stretch

Definition at line 310 of file SawtoothStretchType.cpp.

References p_offsetEdit, and p_widthEdit.

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

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 253 of file SawtoothStretchType.cpp.

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

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

This creates the stretch pairs table.

Returns
QTableWidget*

Definition at line 103 of file StretchType.cpp.

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

Stretch Isis::StretchType::getStretch ( )
virtualinherited

Returns the current stretch object.

Returns
Stretch

Reimplemented in Isis::LinearStretchType.

Definition at line 183 of file StretchType.cpp.

References Isis::StretchType::p_stretch.

Referenced by Isis::StretchType::savePairs(), and Isis::StretchType::updateTable().

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 174 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, Isis::StretchType::stretchChanged(), and Isis::Stretch::Text().

Referenced by SawtoothStretchType(), and setStretch().

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

This is called when the sawtooth offset slider moves.

It updates the edit.

Definition at line 155 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().

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 91 of file StretchType.cpp.

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

Referenced by Isis::AdvancedStretch::setHistogram().

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 103 of file SawtoothStretchType.cpp.

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

Referenced by SawtoothStretchType().

void Isis::StretchType::updateGraph ( )
protectedslotinherited

This updates the graph with the current stretch object.

Definition at line 122 of file StretchType.cpp.

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

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

void Isis::StretchType::updateTable ( )
protectedslotinherited
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 219 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, Isis::StretchType::stretchChanged(), and Isis::Stretch::Text().

Referenced by SawtoothStretchType(), and setStretch().

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

This is called when the sawtooth width slider moves.

It updates the edit.

Definition at line 199 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

HistogramWidget* Isis::StretchType::p_graph
protectedinherited
QGridLayout* Isis::StretchType::p_mainLayout
protectedinherited
QLineEdit* Isis::SawtoothStretchType::p_offsetEdit
private
QSlider* Isis::SawtoothStretchType::p_offsetSlider
private

Offset slider.

Definition at line 54 of file SawtoothStretchType.h.

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

bool Isis::SawtoothStretchType::p_sliderOverride
private

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

Definition at line 60 of file SawtoothStretchType.h.

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

QLineEdit* Isis::SawtoothStretchType::p_widthEdit
private
QSlider* Isis::SawtoothStretchType::p_widthSlider
private

Width slider.

Definition at line 56 of file SawtoothStretchType.h.

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


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