17 const QString& listName,
20 : QDialog(parent),
_window(nullptr)
22 setAttribute(Qt::WA_DeleteOnClose);
25 stationNameLabel->setText(QString::fromStdString(stn->
getName()));
26 stationTypeLabel->setText(listName);
30 : QDialog(parent),
_window(nullptr)
33 stationNameLabel->setText(QString::fromStdString(stn->
getName()));
34 stationTypeLabel->setText(
"");
37 fromDateLine->setText(
46 : QDialog(parent),
_window(window)
48 QFileInfo fi(filename);
50 stationNameLabel->setText(fi.baseName());
51 stationTypeLabel->setText(
"");
62 QDateTime start_date(
getDateTime(fromDateLine->text()));
63 QDateTime end_date(
getDateTime(toDateLine->text()));
65 if (start_date == QDateTime() || end_date == QDateTime() ||
66 start_date > end_date ||
_list.empty())
72 if (
_list[0]->size() == 0)
75 this->done(QDialog::Rejected);
81 bool window_is_empty(
false);
85 _window->setAttribute(Qt::WA_DeleteOnClose);
86 window_is_empty =
true;
89 for (std::size_t i = 0; i <
_list.size(); i++)
93 _list[i]->truncateToRange(start_date, end_date);
95 window_is_empty =
false;
102 this->done(QDialog::Accepted);
114 this->done(QDialog::Rejected);
120 QFileDialog::getOpenFileName(
this,
121 "Select time series file to open",
123 "Time series files (*.stn *.txt)");
124 if (!fileName.isEmpty())
134 for (
auto& item :
_list)
138 item->setXLabel(
"Time");
140 item->setXUnit(
"day");
142 item->setColor(QColor(Qt::red));
144 fromDateLine->setText(
_list[0]->getStartDate().toString(
"dd.MM.yyyy"));
145 QDateTime endDate =
_list[0]->getStartDate().addSecs(
146 static_cast<int>(
_list[0]->maxXValue()));
147 toDateLine->setText(endDate.toString(
"dd.MM.yyyy"));
157 const std::vector<std::pair<QDateTime, float>>& coords)
162 l->
setName(stationTypeLabel->text() +
": " + stationNameLabel->text());
163 l->setXLabel(
"Time");
167 l->setColor(QColor(Qt::red));
177 for (
auto& item :
_list)
179 QCheckBox* box =
new QCheckBox(item->getName());
180 box->setChecked(
true);
181 this->CheckBoxLayout->addWidget(box);
QDateTime getDateTime(QString const &stringDate)
Converts string into QDateTime-format.
Creates a window containing a diagram.
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.