From 6e10ea3e6912d66ed47c96f94e680c8a4f12988f Mon Sep 17 00:00:00 2001 From: giadasan Date: Wed, 26 Jun 2024 13:28:50 +0200 Subject: [PATCH] fix mingw issues & update soil model table --- crop/landUnit.cpp | 2 +- gis/gis.cpp | 14 +++++++------- gis/gisIO.cpp | 2 +- mathFunctions/furtherMathFunctions.cpp | 20 ++++++++++---------- soilWidget/tabHorizons.cpp | 10 ++++++++++ utilities/utilities.cpp | 4 ++-- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/crop/landUnit.cpp b/crop/landUnit.cpp index 15baddc8..be279418 100644 --- a/crop/landUnit.cpp +++ b/crop/landUnit.cpp @@ -63,7 +63,7 @@ bool loadLandUnitList(const QSqlDatabase &dbCrop, std::vector &l int getLandUnitIndex(const std::vector &landUnitList, int idLandUnit) { - for (int index = 0; index < landUnitList.size(); index++) + for (int index = 0; index < int(landUnitList.size()); index++) if (landUnitList[index].id == idLandUnit) return index; diff --git a/gis/gis.cpp b/gis/gis.cpp index 7a0a1fbd..ab29e104 100644 --- a/gis/gis.cpp +++ b/gis/gis.cpp @@ -290,7 +290,7 @@ namespace gis if (!parametersCell.empty()) parametersCell.clear(); parametersCell.resize(initHeader.nrRows*initHeader.nrCols); - for (int i = 0; i < parametersCell.size(); i++) + for (int i = 0; i < int(parametersCell.size()); i++) { parametersCell[i].row = i / initHeader.nrCols; parametersCell[i].col = i % initHeader.nrCols; @@ -303,7 +303,7 @@ namespace gis bool Crit3DRasterGrid::initializeParametersLatLonHeader(const Crit3DLatLonHeader& latLonHeader) { parametersCell.resize(latLonHeader.nrRows*latLonHeader.nrCols); - for (int i = 0; i < parametersCell.size(); i++) + for (int i = 0; i < int(parametersCell.size()); i++) { parametersCell[i].row = i / latLonHeader.nrCols; parametersCell[i].col = i % latLonHeader.nrCols; @@ -498,7 +498,7 @@ namespace gis int index = row * header->nrCols + col; - if (index < parametersCell.size()) + if (index < int(parametersCell.size())) parameters = parametersCell[index].fittingParameters; return parameters; @@ -538,16 +538,16 @@ namespace gis for (j = col-1; j < col+2; j++) { index = i * header->nrCols + j; - if (index >= 0 && index < parametersCell.size() && (parametersCell[index].fittingParameters.size() == activeProxyNr) && (i != row || j !=col)) + if (index >= 0 && index < int(parametersCell.size()) && (parametersCell[index].fittingParameters.size() == activeProxyNr) && (i != row || j !=col)) findFirst = 1; if (findFirst==1) break; } if (findFirst==1) break; } - for (k = 0; k < parametersCell[index].fittingParameters.size(); k++) + for (k = 0; k < int(parametersCell[index].fittingParameters.size()); k++) { - for (l = 0; l < parametersCell[index].fittingParameters[k].size(); l++) + for (l = 0; l < int(parametersCell[index].fittingParameters[k].size()); l++) { avg = 0; counter = 0; @@ -556,7 +556,7 @@ namespace gis for (int m = j; m < col+2; m++) { index = h * header->nrCols + m; - if (index >= 0 && index < parametersCell.size() && (parametersCell[index].fittingParameters.size() == activeProxyNr) && (i != row || j !=col)) + if (index >= 0 && index < int(parametersCell.size()) && (parametersCell[index].fittingParameters.size() == activeProxyNr) && (i != row || j !=col)) { avg += parametersCell[index].fittingParameters[k][l]; counter++; diff --git a/gis/gisIO.cpp b/gis/gisIO.cpp index f81fcbeb..d09fda69 100644 --- a/gis/gisIO.cpp +++ b/gis/gisIO.cpp @@ -237,7 +237,7 @@ namespace gis // remove the curly braces, split the values ​​and remove the spaces cleanBraces(valueStr); vector infoStr = splitCommaDelimited(valueStr); - for (int i = 0; i < infoStr.size(); i++) + for (int i = 0; i < int(infoStr.size()); i++) { cleanSpaces(infoStr[i]); } diff --git a/mathFunctions/furtherMathFunctions.cpp b/mathFunctions/furtherMathFunctions.cpp index 202b49b7..e43306ea 100644 --- a/mathFunctions/furtherMathFunctions.cpp +++ b/mathFunctions/furtherMathFunctions.cpp @@ -218,7 +218,7 @@ double multilinear(std::vector &x, std::vector &par) return NODATA; double y = 0; - for (int i=0; i < x.size(); i++) + for (int i=0; i < int(x.size()); i++) y += par[i] * x[i]; y += par[x.size()]; @@ -1136,13 +1136,13 @@ namespace interpolation double meanObs=0; double RSS=0; double TSS=0; - for (int i=0;i (nrPredictors+1)) + if (int(observed.size()) > (nrPredictors+1)) standardError = sqrt(sum_weighted_squared_residuals/(observed.size()-nrPredictors-1)); else standardError = sqrt(sum_weighted_squared_residuals/(observed.size()-1)); @@ -1943,7 +1943,7 @@ namespace interpolation double error; double norm = 0; - for (int i = 0; i < y.size(); i++) + for (int i = 0; i < int(y.size()); i++) { error = y[i] - func(myFunc,x[i], parameters); norm += error * error * weights[i] * weights[i]; @@ -2009,7 +2009,7 @@ namespace interpolation { for (int dir = 0; dir < 2; ++dir) { - for (int paramIndex = 0; paramIndex < numParamsToVary; ++paramIndex) + for (int paramIndex = 0; paramIndex < int(numParamsToVary); ++paramIndex) { fittingMarquardt_nDimension_noSquares_singleFunction(func,parametersMin, diff --git a/soilWidget/tabHorizons.cpp b/soilWidget/tabHorizons.cpp index 3162bbd6..51e1430a 100644 --- a/soilWidget/tabHorizons.cpp +++ b/soilWidget/tabHorizons.cpp @@ -462,6 +462,16 @@ void TabHorizons::checkComputedValues(int horizonNum) tableModel->item(horizonNum,5)->setBackground(Qt::yellow); } + if (horizon->dbData.effectiveCohesion == NODATA) + { + tableModel->item(horizonNum,11)->setBackground(Qt::yellow); + } + + if (horizon->dbData.frictionAngle == NODATA) + { + tableModel->item(horizonNum,12)->setBackground(Qt::yellow); + } + } diff --git a/utilities/utilities.cpp b/utilities/utilities.cpp index 426322af..ea945b74 100644 --- a/utilities/utilities.cpp +++ b/utilities/utilities.cpp @@ -672,12 +672,12 @@ bool writeJson(const QString & ancestor, const std::vector &fieldNames bool isFloat = false; - for (int i=0; i < values.size(); i++) + for (int i=0; i < int(values.size()); i++) { if (values[i].size() != fieldNames.size() || values[i].size() != dataType.size()) return false; recordObject.empty(); - for (int j=0; j < values[i].size(); j++) + for (int j=0; j < int(values[i].size()); j++) { if (dataType[j] == "float") recordObject.insert(fieldNames[j], values[i][j].toFloat(&isFloat));