28 const QString& listName,
31 : QDialog(parent), _window(nullptr)
33 setAttribute(Qt::WA_DeleteOnClose);
36 stationNameLabel->setText(QString::fromStdString(stn->
getName()));
37 stationTypeLabel->setText(listName);
41 : QDialog(parent), _window(nullptr)
44 stationNameLabel->setText(QString::fromStdString(stn->
getName()));
45 stationTypeLabel->setText(
"");
48 fromDateLine->setText(
57 : QDialog(parent), _window(window)
59 QFileInfo fi(filename);
61 stationNameLabel->setText(fi.baseName());
62 stationTypeLabel->setText(
"");
73 QDateTime start_date(
getDateTime(fromDateLine->text()));
74 QDateTime end_date(
getDateTime(toDateLine->text()));
76 if (start_date == QDateTime() || end_date == QDateTime() ||
77 start_date > end_date ||
_list.empty())
83 if (
_list[0]->size() == 0)
86 this->done(QDialog::Rejected);
92 bool window_is_empty(
false);
96 _window->setAttribute(Qt::WA_DeleteOnClose);
97 window_is_empty =
true;
100 for (std::size_t i = 0; i <
_list.size(); i++)
104 _list[i]->truncateToRange(start_date, end_date);
106 window_is_empty =
false;
110 if (!window_is_empty)
113 this->done(QDialog::Accepted);
125 this->done(QDialog::Rejected);
131 QFileDialog::getOpenFileName(
this,
132 "Select time series file to open",
134 "Time series files (*.stn *.txt)");
135 if (!fileName.isEmpty())
145 for (
auto& item :
_list)
149 item->setXLabel(
"Time");
151 item->setXUnit(
"day");
153 item->setColor(QColor(Qt::red));
155 fromDateLine->setText(
_list[0]->getStartDate().toString(
"dd.MM.yyyy"));
156 QDateTime endDate =
_list[0]->getStartDate().addSecs(
157 static_cast<int>(
_list[0]->maxXValue()));
158 toDateLine->setText(endDate.toString(
"dd.MM.yyyy"));
168 const std::vector<std::pair<QDateTime, float>>& coords)
173 l->
setName(stationTypeLabel->text() +
": " + stationNameLabel->text());
174 l->setXLabel(
"Time");
178 l->setColor(QColor(Qt::red));
188 for (
auto& item :
_list)
190 QCheckBox* box =
new QCheckBox(item->getName());
191 box->setChecked(
true);
192 this->CheckBoxLayout->addWidget(box);
Definition of the DetailWindow class.
Definition of the DiagramList class.
Definition of the DiagramPrefsDialog class.
QDateTime getDateTime(QString const &stringDate)
Converts string into QDateTime-format.
Definition of the OGSError class.
Definition of the Station class.
Creates a window containing a diagram.
void addList(DiagramList *list)
A List of data points and all the necessary meta-information to draw a graph.
static int readList(const QString &path, std::vector< DiagramList * > &list)
void setName(QString name)
Sets the name of the graph to be displayed in the caption.
void on_loadFileButton_clicked()
Instructions if the "Load File"-Button has been pressed.
void createVisibilityCheckboxes()
DiagramPrefsDialog(const GeoLib::Station *stn, const QString &listName, QDialog *parent=nullptr)
void reject() override
Instructions if the Cancel-Button has been pressed.
~DiagramPrefsDialog() override
int loadFile(const QString &filename)
int loadList(const std::vector< std::pair< QDateTime, float > > &coords)
std::vector< QCheckBox * > _visability
std::vector< DiagramList * > _list
A Station (observation site) is basically a Point with some additional information.
std::string const & getName() const
Returns the name of the station.
const SensorData * getSensorData() const
Returns all the sensor data for this observation site.
static void box(const QString &e)
std::size_t getEndTime() const
Returns the last time step.
std::size_t getStartTime() const
Returns the first time step.