From fbf4d2df73518d8539b3581e10ef1457325759a0 Mon Sep 17 00:00:00 2001 From: ftomei Date: Wed, 14 Aug 2024 11:07:01 +0200 Subject: [PATCH] fix meteoWidget --- meteoWidget/meteoWidget.cpp | 43 ++++++++++++++----------------------- meteoWidget/meteoWidget.h | 1 - project/project.cpp | 4 ---- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/meteoWidget/meteoWidget.cpp b/meteoWidget/meteoWidget.cpp index 5324411ce..48d133c45 100644 --- a/meteoWidget/meteoWidget.cpp +++ b/meteoWidget/meteoWidget.cpp @@ -146,6 +146,7 @@ Crit3DMeteoWidget::Crit3DMeteoWidget(bool isGrid_, QString projectPath, Crit3DMe { _currentFrequency = hourly; } + MapCSVDefault.insert(key,items); zeroLine = new QLineSeries(); zeroLine->setColor(Qt::gray); @@ -196,11 +197,11 @@ Crit3DMeteoWidget::Crit3DMeteoWidget(bool isGrid_, QString projectPath, Crit3DMe { if (currentVariables[i].contains("DAILY")) { - dailyVar = dailyVar+1; + dailyVar++; } else { - hourlyVar = hourlyVar+1; + hourlyVar++; } } @@ -532,29 +533,7 @@ void Crit3DMeteoWidget::updateTimeRange() } } - checkExistingData(); -} - - -void Crit3DMeteoWidget::checkExistingData() -{ - // set enable/disable buttons if daily/hourly/monthly data are available - if ( (!firstDailyDate.isValid() || firstDailyDate.year() == 1800) && (!lastDailyDate.isValid() || lastDailyDate.year() == 1800) ) - { - dailyButton->setVisible(false); - } - else - { - dailyButton->setVisible(true); - } - if ( (!firstHourlyDate.isValid() || firstHourlyDate.year() == 1800) && (!lastHourlyDate.isValid() || lastHourlyDate.year() == 1800) ) - { - hourlyButton->setVisible(false); - } - else - { - hourlyButton->setVisible(true); - } + // enable/disable monthly button if monthly data are available if ( (!firstMonthlyDate.isValid() || firstMonthlyDate.year() == 1800) && (!lastMonthlyDate.isValid() || lastMonthlyDate.year() == 1800) ) { monthlyButton->setVisible(false); @@ -1581,7 +1560,12 @@ void Crit3DMeteoWidget::drawHourlyVar() { for (int i = 0; i < nameLines.size(); i++) { - meteoVariable meteoVar = MapHourlyMeteoVar.at(nameLines[i].toStdString()); + meteoVariable meteoVar = getMeteoVar(nameLines[i].toStdString()); + if (meteoVar == noMeteoVar) + { + continue; + } + double value = meteoPoints[mp].getMeteoPointValueH(myCrit3DDate, h, 0, meteoVar); if (value != NODATA) { @@ -1609,7 +1593,12 @@ void Crit3DMeteoWidget::drawHourlyVar() { for (int j = 0; j < nameBar.size(); j++) { - meteoVariable meteoVar = MapHourlyMeteoVar.at(nameBar[j].toStdString()); + meteoVariable meteoVar = getMeteoVar(nameBar[j].toStdString()); + if (meteoVar == noMeteoVar) + { + continue; + } + double value = meteoPoints[mp].getMeteoPointValueH(myCrit3DDate, h, 0, meteoVar); if (value != NODATA) { diff --git a/meteoWidget/meteoWidget.h b/meteoWidget/meteoWidget.h index d27e6c62c..c94d0a59d 100644 --- a/meteoWidget/meteoWidget.h +++ b/meteoWidget/meteoWidget.h @@ -132,7 +132,6 @@ void drawAxisTitle(); void drawSum(); - void checkExistingData(); signals: diff --git a/project/project.cpp b/project/project.cpp index 89afff4fd..266c4f2d4 100644 --- a/project/project.cpp +++ b/project/project.cpp @@ -3417,10 +3417,6 @@ void Project::showMeteoWidgetPoint(std::string idMeteoPoint, std::string namePoi if (hasHourlyData) { meteoWidgetPoint->setHourlyRange(firstHourly.date(), lastHourly.date()); - if (! hasDailyData) - { - meteoWidgetPoint->setFrequency(hourly); - } } meteoWidgetPoint->setCurrentDate(this->currentDate);