Skip to content
Snippets Groups Projects
Commit fc3cae7a authored by Andre Offringa's avatar Andre Offringa
Browse files

Work in progress

parent e14ae25e
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
#include "../rfigui/controllers/rfiguicontroller.h"
#include "../util/logger.h"
#include "../util/progress/stdoutreporter.h"
#include "../imagesets/msimageset.h"
#include "../imagesets/msoptions.h"
......@@ -152,16 +153,24 @@ static void run(int argc, char* argv[]) {
if (imageSet == nullptr)
throw std::runtime_error(
"Option -save-baseline can only be used for measurement sets.\n");
MaskedHeatMap& plot = controller.TFController().Plot();
plot.SetShowOriginalMask(plotFlags);
plot.SetShowXAxisDescription(true);
plot.SetShowYAxisDescription(true);
plot.SetShowZAxisDescription(true);
for (const SavedBaseline& b : savedBaselines) {
auto index =
imageSet->Index(b.a1Index, b.a2Index, b.bandIndex, b.sequenceIndex);
if (!index) throw std::runtime_error("Baseline not found!");
controller.SetImageSetIndex(*index);
StdOutReporter reporter;
reporter.SignalFinished().connect([&](bool success) {
std::cout << "FINISH\n";
//controller.LoadCurrentTFDataFinish(success);
});
std::thread thread(
[&]() { controller.LoadCurrentTFDataAsync(reporter); });
thread.join();
MaskedHeatMap& plot = controller.TFController().Plot();
plot.SetShowOriginalMask(plotFlags);
plot.SetShowXAxisDescription(true);
plot.SetShowYAxisDescription(true);
plot.SetShowZAxisDescription(true);
plot.SaveByExtension(b.filename, 800, 480);
}
}
......
......@@ -7,6 +7,8 @@
#include <string>
#include <iostream>
#include <sigc++/signal.h>
class StdOutReporter final : public ProgressListener {
public:
void OnStartTask(const std::string& description) override {
......@@ -21,10 +23,20 @@ class StdOutReporter final : public ProgressListener {
std::cout << '.' << std::flush;
}
}
void OnFinish() override { std::cout << "100\n"; }
void OnFinish() override { std::cout << "100\n"; _signalFinished(true); }
void OnException(std::exception& thrown_exception) override {
std::cerr << "ERROR! " << thrown_exception.what() << '\n';
_signalError(thrown_exception.what());
_signalFinished(false);
}
sigc::signal<void, bool /*errors occurred? */>& SignalFinished() {
return _signalFinished;
}
sigc::signal<void, const std::string&>& SignalError() { return _signalError; }
private:
sigc::signal<void, bool> _signalFinished;
sigc::signal<void, const std::string&> _signalError;
};
#endif // UTIL_PROGRESS_STD_OUT_REPORTER_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment