Skip to content

Commit

Permalink
Added progress bar to RunUntilFinished
Browse files Browse the repository at this point in the history
  • Loading branch information
smistad committed Mar 15, 2024
1 parent db8e249 commit 34c1b49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/FAST/Algorithms/RunUntilFinished/RunUntilFinished.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ namespace fast {
RunUntilFinished::RunUntilFinished() {
createInputPort(0);
createOutputPort(0);
m_finished = false;
}

void RunUntilFinished::execute() {
// TODO this assumes the parent only has 1 output port
auto parentPO = mInputConnections[0]->getProcessObject();
if(m_finished) {
return;
}
// TODO this assumes the parent only has 1 output port
DataObject::pointer inputData;
Progress progress(1000);
progress.setText("Running ");
do {
inputData = parentPO->runAndGetOutputData();
if(inputData->hasFrameData("progress"))
progress.update(round(1000*inputData->getFrameData<float>("progress")));
} while(!inputData->isLastFrame());
progress.update(1000);
m_finished = true;
addOutputData(0, inputData);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class FAST_EXPORT RunUntilFinished : public ProcessObject {
FAST_CONSTRUCTOR(RunUntilFinished);
private:
void execute() override;
bool m_finished = false;
};

}

0 comments on commit 34c1b49

Please sign in to comment.