Skip to content

Commit

Permalink
Merge commit '6a601459a892560e203fdcf30105cd98a50a84db'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Aug 14, 2024
2 parents 3d4be84 + 6a60145 commit d656d75
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
43 changes: 16 additions & 27 deletions agrolib/meteoWidget/meteoWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Crit3DMeteoWidget::Crit3DMeteoWidget(bool isGrid_, QString projectPath, Crit3DMe
{
_currentFrequency = hourly;
}

MapCSVDefault.insert(key,items);
zeroLine = new QLineSeries();
zeroLine->setColor(Qt::gray);
Expand Down Expand Up @@ -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++;
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion agrolib/meteoWidget/meteoWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@

void drawAxisTitle();
void drawSum();
void checkExistingData();


signals:
Expand Down
4 changes: 0 additions & 4 deletions agrolib/project/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d656d75

Please sign in to comment.