10 #include "ui_G3PointPlots.h"
35 setWindowTitle(title);
37 connect(this->ui->exportCSVToolButton, &QToolButton::clicked,
this,
39 connect(this->ui->exportImage, &QToolButton::clicked,
this,
46 QSettings settings(
"OSERen",
"qG3Point");
47 settings.setValue(
"G3PointPlots/geometry", saveGeometry());
49 QWidget::closeEvent(
event);
53 QSettings settings(
"OSERen",
"qG3Point");
54 restoreGeometry(settings.value(
"G3PointPlots/geometry").toByteArray());
58 this->ui->tabWidget->addTab(widget, widget->windowTitle());
59 this->ui->tabWidget->setCurrentWidget(widget);
61 if (widget->property(
"TypeOfCustomPlot").toString() ==
"AnglesCustomPlot") {
65 }
else if (widget->property(
"TypeOfCustomPlot").toString() ==
74 this->ui->tabWidget->currentWidget()->deleteLater();
77 template <
typename SharedDataContainer>
79 SharedDataContainer container,
80 const Eigen::Array3d* dq_final,
81 const Eigen::Array3d* edq)
const {
83 if (!file.open(QFile::WriteOnly | QFile::Text)) {
89 QTextStream stream(&file);
90 stream.setRealNumberPrecision(12);
91 stream.setRealNumberNotation(QTextStream::FixedNotation);
97 stream << (*dq_final)(0) <<
" " << (*dq_final)(1) <<
" "
99 stream <<
"# std(D10) [mm], std(D50) [mm], std(D90) [mm]"
101 stream << (*edq)(0) <<
" " << (*edq)(1) <<
" " << (*edq)(2)
111 for (
auto item : *container) {
128 QWidget* currentWidget = this->ui->tabWidget->currentWidget();
133 QString currentPath =
137 currentPath += QString(
"/") + currentWidget->windowTitle() +
".csv";
140 QString
filename = QFileDialog::getSaveFileName(
this,
"Select output file",
141 currentPath,
"*.csv");
151 if (currentWidget->property(
"TypeOfCustomPlot").toString() ==
152 "AnglesCustomPlot") {
153 Eigen::Array3d dq_final;
155 exportToCSV<SharedBarsDataContainer>(
158 }
else if (currentWidget->property(
"TypeOfCustomPlot").toString() ==
159 "WolmanCustomPlot") {
162 exportToCSV<SharedGraphDataContainer>(
169 QWidget* currentWidget = this->ui->tabWidget->currentWidget();
174 QString currentPath =
179 "Select output file", currentWidget->windowTitle(), currentPath,
182 if (outputFilename.isEmpty()) {
189 QFileInfo(outputFilename).absolutePath());
193 QPixmap
image = currentWidget->grab();
194 if (
image.save(outputFilename)) {
195 CVLog::Print(QString(
"[SF/SF] Image '%1' successfully saved")
196 .arg(outputFilename));
198 CVLog::Error(QString(
"Failed to save file '%1'").arg(outputFilename));
std::shared_ptr< core::Tensor > image
QSharedPointer< QCPBarsDataContainer > SharedBarsDataContainer
QSharedPointer< QCPGraphDataContainer > SharedGraphDataContainer
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Print(const char *format,...)
Prints out a formatted message in console.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
void addToTabWidget(QWidget *widget)
G3PointPlots(QString title, QWidget *parent=nullptr)
qCC_db
void closeCurrentWidget()
bool exportToCSV(QString filename, SharedDataContainer container, const Eigen::Array3d *dq_final=nullptr, const Eigen::Array3d *edq=nullptr) const
void closeEvent(QCloseEvent *event) override
static QString GetSaveFilename(const QString &dialogTitle, const QString &baseName, const QString &imageSavePath, QWidget *parentWidget=nullptr)
Helper: select an output image filename.
Eigen::Array3d m_dq_final
QSharedPointer< QCPGraphDataContainer > dataContainer()
static const QString CurrentPath()
static const QString SaveFile()
QTextStream & endl(QTextStream &stream)
QString defaultDocPath()
Shortcut for getting the documents location path.