Skip to content

Commit

Permalink
Merge commit 'e300ce5afc931b7d6132dac8fa3aea6a9b1ba8c6'
Browse files Browse the repository at this point in the history
  • Loading branch information
gantolini committed Feb 13, 2024
2 parents b58441c + e300ce5 commit 4948a36
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
7 changes: 6 additions & 1 deletion agrolib/climate/climate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,12 @@ bool elaborateDailyAggrVarFromDailyFromStartDate(meteoVariable myVar, Crit3DMete

for (QDate myDate = first; myDate<=last; myDate=myDate.addDays(1))
{
unsigned int index = firstDate.daysTo(myDate);
unsigned long index = firstDate.daysTo(myDate);
if (index >= meteoPoint.obsDataD.size())
{
break;
}

switch(myVar)
{
case dailyThomDaytime:
Expand Down
44 changes: 25 additions & 19 deletions agrolib/pointStatisticsWidget/pointStatisticsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,41 @@ Crit3DPointStatisticsWidget::Crit3DPointStatisticsWidget(bool isGrid, Crit3DMete
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->setAttribute(Qt::WA_DeleteOnClose);

// joint stations
idPoints << this->meteoPoints[0].id;
QList<QString> jointStationsMyMp = meteoPointsDbHandler->getJointStations(QString::fromStdString(this->meteoPoints[0].id));
for (int j = 0; j<jointStationsMyMp.size(); j++)
QList<QString> jointStationsMyMp;
if (meteoPointsDbHandler != nullptr)
{
idPoints << jointStationsMyMp[j].toStdString();
// load all Data
jointStationsMyMp = meteoPointsDbHandler->getJointStations(QString::fromStdString(this->meteoPoints[0].id));
for (int j = 0; j<jointStationsMyMp.size(); j++)
{
idPoints << jointStationsMyMp[j].toStdString();
// load all Data

QDate firstDaily = meteoPointsDbHandler->getFirstDate(daily, jointStationsMyMp[j].toStdString()).date();
QDate lastDaily = meteoPointsDbHandler->getLastDate(daily, jointStationsMyMp[j].toStdString()).date();
QDate firstDaily = meteoPointsDbHandler->getFirstDate(daily, jointStationsMyMp[j].toStdString()).date();
QDate lastDaily = meteoPointsDbHandler->getLastDate(daily, jointStationsMyMp[j].toStdString()).date();

QDateTime firstHourly = meteoPointsDbHandler->getFirstDate(hourly, jointStationsMyMp[j].toStdString());
QDateTime lastHourly = meteoPointsDbHandler->getLastDate(hourly, jointStationsMyMp[j].toStdString());
for (int n = 0; n<this->meteoPoints.size(); n++)
{
if (this->meteoPoints[n].id == jointStationsMyMp[j].toStdString())
QDateTime firstHourly = meteoPointsDbHandler->getFirstDate(hourly, jointStationsMyMp[j].toStdString());
QDateTime lastHourly = meteoPointsDbHandler->getLastDate(hourly, jointStationsMyMp[j].toStdString());
for (int n = 0; n<this->meteoPoints.size(); n++)
{
jointStationsSelected.addItem(QString::fromStdString(this->meteoPoints[n].id)+" "+QString::fromStdString(this->meteoPoints[n].name));
if (firstDaily.isValid() && lastDaily.isValid())
if (this->meteoPoints[n].id == jointStationsMyMp[j].toStdString())
{
meteoPointsDbHandler->loadDailyData(getCrit3DDate(firstDaily), getCrit3DDate(lastDaily), &(this->meteoPoints[n]));
}
if (firstHourly.isValid() && lastHourly.isValid())
{
meteoPointsDbHandler->loadHourlyData(getCrit3DDate(firstHourly.date()), getCrit3DDate(lastHourly.date()), &(this->meteoPoints[n]));
jointStationsSelected.addItem(QString::fromStdString(this->meteoPoints[n].id)+" "+QString::fromStdString(this->meteoPoints[n].name));
if (firstDaily.isValid() && lastDaily.isValid())
{
meteoPointsDbHandler->loadDailyData(getCrit3DDate(firstDaily), getCrit3DDate(lastDaily), &(this->meteoPoints[n]));
}
if (firstHourly.isValid() && lastHourly.isValid())
{
meteoPointsDbHandler->loadHourlyData(getCrit3DDate(firstHourly.date()), getCrit3DDate(lastHourly.date()), &(this->meteoPoints[n]));
}
break;
}
break;
}
}
}

// layout
QVBoxLayout *mainLayout = new QVBoxLayout();
QHBoxLayout *upperLayout = new QHBoxLayout();
Expand Down

0 comments on commit 4948a36

Please sign in to comment.