Isis 3 Programmer Reference
|
Program progress reporter. More...
#include <Progress.h>
Public Member Functions | |
Progress () | |
Constructs a Progress object. More... | |
~Progress () | |
Destroys the Progress object. More... | |
void | SetText (const QString &text) |
Changes the value of the text string reported just before 0% processed. More... | |
QString | Text () const |
Returns the text to output. More... | |
void | SetMaximumSteps (const int steps) |
This sets the maximum number of steps in the process. More... | |
void | AddSteps (const int steps) |
If the initial step size was a guess, it can be modified using this method. More... | |
void | CheckStatus () |
Checks and updates the status. More... | |
void | DisableAutomaticDisplay () |
Turns off updating the Isis Gui when CheckStatus() is called. More... | |
int | MaximumSteps () const |
Returns the maximum number of steps of the progress. More... | |
int | CurrentStep () const |
Returns the current step of the progress. More... | |
Private Attributes | |
QString | p_text |
Text string to output at the initial call to CheckStatus (0% processed) More... | |
int | p_maximumSteps |
Number of steps in your processing sequence. More... | |
int | p_currentStep |
The current step in the processing sequence. More... | |
int | p_currentPercent |
The current percent we are checking against. More... | |
int | p_percentIncrement |
How much to increment the currentPercent by. More... | |
bool | p_printPercent |
bool | p_autoDisplay |
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.
Definition at line 42 of file Progress.h.
Isis::Progress::Progress | ( | ) |
Constructs a Progress object.
Isis::iException::User |
Definition at line 22 of file Progress.cpp.
References Isis::PvlObject::findGroup().
Isis::Progress::~Progress | ( | ) |
Destroys the Progress object.
Definition at line 50 of file Progress.cpp.
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.
steps | Amount to adjust the MaximumSteps by |
Definition at line 199 of file Progress.cpp.
Referenced by Isis::ImageOverlapSet::FindAllOverlaps(), and Isis::OverlapStatistics::OverlapStatistics().
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.
IException::Programmer | Step exceeds maximumSteps |
Definition at line 105 of file Progress.cpp.
References Isis::Application::ProcessGuiEvents(), and Isis::Application::UpdateProgress().
Referenced by Isis::Process::CalculateStatistics(), Isis::GroundGrid::CreateGrid(), Isis::ImageOverlapSet::FindAllOverlaps(), 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::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::Pipeline::Run(), Isis::ProcessByBrick::RunProcess(), Isis::SerialNumberList::SerialNumberList(), Isis::ControlNet::SetImages(), Isis::ProcessExport::StartProcess(), Isis::ProcessByQuickFilter::StartProcess(), and Isis::Cube::statistics().
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.
Definition at line 185 of file Progress.cpp.
Referenced by Isis::ImportControlNetWorkOrder::execute().
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().
int Isis::Progress::MaximumSteps | ( | ) | const |
Returns the maximum number of steps of the progress.
Definition at line 172 of file Progress.cpp.
Referenced by Isis::ImportControlNetWorkOrder::execute().
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.
steps | Maximum number of steps |
IException::Programmer | Invalid value for step (must be >0) |
Definition at line 85 of file Progress.cpp.
Referenced by Isis::Process::CalculateStatistics(), Isis::GroundGrid::CreateGrid(), Isis::ImageOverlapSet::FindAllOverlaps(), 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::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::Pipeline::Run(), Isis::ProcessByBrick::RunProcess(), Isis::SerialNumberList::SerialNumberList(), Isis::ControlNet::SetImages(), Isis::ProcessByQuickFilter::StartProcess(), and Isis::Cube::statistics().
void Isis::Progress::SetText | ( | const QString & | text | ) |
Changes the value of the text string reported just before 0% processed.
This text is only output under the following condition. After SetMaximumSteps is called, the first call to CheckStatus will immediately output the text. By default this is set to "Working".
text | Text to output. |
Definition at line 61 of file Progress.cpp.
Referenced by Isis::Equalization::applyCorrection(), Isis::Equalization::calculateBandStatistics(), Isis::Process::CalculateStatistics(), Isis::ImageOverlapSet::FindAllOverlaps(), Isis::InterestOperator::FindCnetRef(), Isis::ControlNetStatistics::GenerateImageStats(), Isis::ControlNetStatistics::GeneratePointStats(), Isis::Cube::histogram(), Isis::ImageHistogram::ImageHistogram(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ProcessExport::ProcessExport(), Isis::ProcessImport::ProcessImport(), 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::ProcessMapMosaic::RingsSetOutputCube(), Isis::Pipeline::Run(), Isis::SerialNumberList::SerialNumberList(), Isis::ControlNet::SetImages(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::SpectralDefinition2D::SpectralDefinition2D(), Isis::ProcessMapMosaic::StartProcess(), and Isis::Cube::statistics().
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.
Definition at line 72 of file Progress.cpp.
|
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.
|
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.
|
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.
|
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.
|
private |
Text string to output at the initial call to CheckStatus (0% processed)
Definition at line 72 of file Progress.h.