Isis 3 Programmer Reference
Isis::Progress Class Reference

Program progress reporter. More...

#include <Progress.h>

Collaboration diagram for Isis::Progress:
Collaboration graph

Public Member Functions

 Progress ()
 Constructs a Progress object.
 
 ~Progress ()
 Destroys the Progress object.
 
void SetText (const QString &text)
 Changes the value of the text string reported just before 0% processed.
 
QString Text () const
 Returns the text to output.
 
void SetMaximumSteps (const int steps)
 This sets the maximum number of steps in the process.
 
void AddSteps (const int steps)
 If the initial step size was a guess, it can be modified using this method.
 
void CheckStatus ()
 Checks and updates the status.
 
void DisableAutomaticDisplay ()
 Turns off updating the Isis Gui when CheckStatus() is called.
 
int MaximumSteps () const
 Returns the maximum number of steps of the progress.
 
int CurrentStep () const
 Returns the current step of the progress.
 

Private Attributes

QString p_text
 Text string to output at the initial call to CheckStatus (0% processed)
 
int p_maximumSteps
 Number of steps in your processing sequence.
 
int p_currentStep
 The current step in the processing sequence.
 
int p_currentPercent
 The current percent we are checking against.
 
int p_percentIncrement
 How much to increment the currentPercent by.
 
bool p_printPercent
 
bool p_autoDisplay
 

Detailed Description

Program progress reporter.

This class is used to output the percent completion for programs in either the command line mode or the graphical user interface. Generally, this object is created within a Process derived class. Therefore you should only use this object if you are developing such a class.

Author
2002-05-22 Jeff Anderson
History

2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...

2004-02-29 Jeff Anderson - Added ability to send progress status to the parent process

2005-02-11 Elizabeth Ribelin - Modified file to support Doxygen documentation

2005-10-03 Elizabeth Miller - Changed

2012-03-13 Steven Lambright - Added DisableAutomaticGuiRedraws().

2012-09-11 Steven Lambright - Added accessors to the current progress value and range. Renamed DisableAutomaticGuiRedraws() to DisableAutomaticDisplay() in order to include command-line progress printouts.

2012-10-04 Jeannie Backer - Removed documentation reference to the now non-existant CubeInfo class. No mantis ticket related to this change.

Definition at line 42 of file Progress.h.

Constructor & Destructor Documentation

◆ Progress()

Isis::Progress::Progress ( )

Constructs a Progress object.

Exceptions
Isis::iException::User

Definition at line 22 of file Progress.cpp.

References p_currentPercent, p_currentStep, p_maximumSteps, p_percentIncrement, p_text, and Isis::IException::User.

◆ ~Progress()

Isis::Progress::~Progress ( )

Destroys the Progress object.

Definition at line 50 of file Progress.cpp.

Member Function Documentation

◆ AddSteps()

void Isis::Progress::AddSteps ( const int steps)

If the initial step size was a guess, it can be modified using this method.

For example, if you SetMaximumSteps(11) then call AddSteps(1) then the new MaximumSteps is 12. The progress bar will not go backwards (it will not drop from 10% to 5%). "steps" can be negative to remove steps.

Parameters
stepsAmount to adjust the MaximumSteps by

Definition at line 199 of file Progress.cpp.

References p_currentStep, p_maximumSteps, and Isis::IException::Programmer.

Referenced by Isis::OverlapStatistics::OverlapStatistics().

◆ CheckStatus()

void Isis::Progress::CheckStatus ( )

Checks and updates the status.

The first time this is invoked, it outputs the text from SetText and 0% processed. It should then be invoked for each step, for example, a step could be considered processing a line for NL lines in the image. If you do not call this enough times you will not reached 100% processed.

Exceptions
IException::ProgrammerStep exceeds maximumSteps

Definition at line 105 of file Progress.cpp.

References p_currentPercent, p_currentStep, p_maximumSteps, p_percentIncrement, p_text, Isis::Application::ProcessGuiEvents(), Isis::IException::Programmer, and Isis::Application::UpdateProgress().

Referenced by Isis::ProcessByBrick::BlockingReportProgress(), Isis::Process::CalculateStatistics(), Isis::GroundGrid::CreateGrid(), Isis::InterestOperator::FindCnetRef(), Isis::ControlNetStatistics::GenerateImageStats(), Isis::ControlNetStatistics::GeneratePointStats(), Isis::Cube::histogram(), Isis::ImageHistogram::ImageHistogram(), Isis::CameraStatistics::init(), Isis::ProcessExport::InitProcess(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), Isis::ProcessImport::ProcessBsq(), Isis::ProcessImport::ProcessJp2(), Isis::ProcessRubberSheet::processPatchTransform(), Isis::ControlNet::ReadControl(), Isis::ControlNetVersioner::readProtobufV0001(), Isis::ControlNetVersioner::readProtobufV0002(), Isis::ControlNetVersioner::readProtobufV0005(), Isis::ControlNetVersioner::readPvlV0001(), Isis::ControlNetVersioner::readPvlV0002(), Isis::ControlNetVersioner::readPvlV0003(), Isis::ControlNetVersioner::readPvlV0004(), Isis::ControlNetVersioner::readPvlV0005(), Isis::ProcessByBrick::RunProcess(), Isis::SerialNumberList::SerialNumberList(), Isis::LidarData::SetImages(), Isis::ControlNet::SetImages(), Isis::ProcessMosaic::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessExport::StartProcess(), Isis::ProcessRubberSheet::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessExport::StartProcess(), Isis::ProcessByBoxcar::StartProcess(), Isis::ProcessByQuickFilter::StartProcess(), Isis::ProcessByBrick::StartProcess(), and Isis::Cube::statistics().

◆ CurrentStep()

int Isis::Progress::CurrentStep ( ) const

Returns the current step of the progress.

This value should always be in the range of: [0, MaximumSteps()]. CheckStatus() increments the current step.

See also
CheckStatus()
Returns
The current step of the progress

Definition at line 185 of file Progress.cpp.

References p_currentStep.

Referenced by Isis::ImportControlNetWorkOrder::execute().

◆ DisableAutomaticDisplay()

void Isis::Progress::DisableAutomaticDisplay ( )

Turns off updating the Isis Gui when CheckStatus() is called.

You must use RedrawProgress() to visually update the current progress.

Definition at line 161 of file Progress.cpp.

Referenced by Isis::ImportControlNetWorkOrder::execute().

◆ MaximumSteps()

int Isis::Progress::MaximumSteps ( ) const

Returns the maximum number of steps of the progress.

See also
SetMaximumSteps()
Returns
The maximum number of steps of the progress.

Definition at line 172 of file Progress.cpp.

References p_maximumSteps.

Referenced by Isis::ImportControlNetWorkOrder::execute().

◆ SetMaximumSteps()

void Isis::Progress::SetMaximumSteps ( const int steps)

This sets the maximum number of steps in the process.

Whenever this is invoked it also resets the counters to their initial states. This allows for programs which have multiple steps.

Parameters
stepsMaximum number of steps
Exceptions
IException::ProgrammerInvalid value for step (must be >0)

Definition at line 85 of file Progress.cpp.

References p_currentPercent, p_currentStep, p_maximumSteps, and Isis::IException::Programmer.

Referenced by Isis::Process::CalculateStatistics(), Isis::GroundGrid::CreateGrid(), Isis::InterestOperator::FindCnetRef(), Isis::ControlNetStatistics::GenerateImageStats(), Isis::ControlNetStatistics::GeneratePointStats(), Isis::Cube::histogram(), Isis::ImageHistogram::ImageHistogram(), Isis::CameraStatistics::init(), Isis::ProcessExport::InitProcess(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), Isis::ProcessImport::ProcessBsq(), Isis::ProcessImport::ProcessJp2(), Isis::ProcessRubberSheet::processPatchTransform(), Isis::ControlNet::ReadControl(), Isis::ControlNetVersioner::readProtobufV0001(), Isis::ControlNetVersioner::readProtobufV0002(), Isis::ControlNetVersioner::readProtobufV0005(), Isis::ControlNetVersioner::readPvlV0001(), Isis::ControlNetVersioner::readPvlV0002(), Isis::ControlNetVersioner::readPvlV0003(), Isis::ControlNetVersioner::readPvlV0004(), Isis::ControlNetVersioner::readPvlV0005(), Isis::ProcessByBrick::RunProcess(), Isis::SerialNumberList::SerialNumberList(), Isis::LidarData::SetImages(), Isis::ControlNet::SetImages(), Isis::ProcessMosaic::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessRubberSheet::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBoxcar::StartProcess(), Isis::ProcessByQuickFilter::StartProcess(), Isis::ProcessByBrick::StartProcess(), and Isis::Cube::statistics().

◆ SetText()

◆ Text()

QString Isis::Progress::Text ( ) const

Returns the text to output.

Generally, this in not needed except rare circumstances where an application has multiple steps and the text string needs to be saved and restored.

Returns
string

Definition at line 72 of file Progress.cpp.

References p_text.

Member Data Documentation

◆ p_autoDisplay

bool Isis::Progress::p_autoDisplay
private

Definition at line 88 of file Progress.h.

◆ p_currentPercent

int Isis::Progress::p_currentPercent
private

The current percent we are checking against.

Once this percentage is exceeded we report that percentage is completed and increase this value by the increment.

Definition at line 80 of file Progress.h.

Referenced by CheckStatus(), Progress(), and SetMaximumSteps().

◆ p_currentStep

int Isis::Progress::p_currentStep
private

The current step in the processing sequence.

This is incremented by one everytime CheckStatus is called.

Definition at line 77 of file Progress.h.

Referenced by AddSteps(), CheckStatus(), CurrentStep(), Progress(), and SetMaximumSteps().

◆ p_maximumSteps

int Isis::Progress::p_maximumSteps
private

Number of steps in your processing sequence.

For example, if there are 20 lines in an cube. This will be 20.

Definition at line 74 of file Progress.h.

Referenced by AddSteps(), CheckStatus(), MaximumSteps(), Progress(), and SetMaximumSteps().

◆ p_percentIncrement

int Isis::Progress::p_percentIncrement
private

How much to increment the currentPercent by.

It should only be 1,2, 5, or 10.

Definition at line 84 of file Progress.h.

Referenced by CheckStatus(), and Progress().

◆ p_printPercent

bool Isis::Progress::p_printPercent
private

Definition at line 86 of file Progress.h.

◆ p_text

QString Isis::Progress::p_text
private

Text string to output at the initial call to CheckStatus (0% processed)

Definition at line 72 of file Progress.h.

Referenced by CheckStatus(), Progress(), SetText(), and Text().


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