diff --git a/agrolib/graphics/mapGraphicsRasterObject.cpp b/agrolib/graphics/mapGraphicsRasterObject.cpp
index d1c16beb5..24a428777 100644
--- a/agrolib/graphics/mapGraphicsRasterObject.cpp
+++ b/agrolib/graphics/mapGraphicsRasterObject.cpp
@@ -73,16 +73,6 @@ void RasterObject::clear()
}
-void RasterObject::setRaster(gis::Crit3DRasterGrid* rasterPtr)
-{
- rasterPointer = rasterPtr;
-}
-
-gis::Crit3DRasterGrid* RasterObject::getRaster()
-{
- return rasterPointer;
-}
-
void RasterObject::setDrawing(bool value)
{
isDrawing = value;
diff --git a/agrolib/graphics/mapGraphicsRasterObject.h b/agrolib/graphics/mapGraphicsRasterObject.h
index bcfa71878..da44166f8 100644
--- a/agrolib/graphics/mapGraphicsRasterObject.h
+++ b/agrolib/graphics/mapGraphicsRasterObject.h
@@ -79,8 +79,10 @@
const gis::Crit3DLatLonHeader& latLonHeader, bool isGrid_);
float getRasterMaxSize();
gis::Crit3DGeoPoint* getRasterCenter();
- void setRaster(gis::Crit3DRasterGrid* rasterPtr);
- gis::Crit3DRasterGrid* getRaster();
+
+ void setRaster(gis::Crit3DRasterGrid* rasterPtr) { rasterPointer = rasterPtr; }
+ gis::Crit3DRasterGrid* getRasterPointer() { return rasterPointer; }
+
void updateCenter();
Position getCurrentCenter();
diff --git a/agrolib/graphics/mapGraphicsRasterUtm.h b/agrolib/graphics/mapGraphicsRasterUtm.h
index 2a67e962b..ec679ef66 100644
--- a/agrolib/graphics/mapGraphicsRasterUtm.h
+++ b/agrolib/graphics/mapGraphicsRasterUtm.h
@@ -70,7 +70,7 @@
void setColorLegend(ColorLegend* colorLegendPtr) {_colorLegendPointer = colorLegendPtr;}
void setRaster(gis::Crit3DRasterGrid* rasterPtr) {_rasterPointer = rasterPtr;}
- gis::Crit3DRasterGrid* getRaster() {return _rasterPointer;}
+ gis::Crit3DRasterGrid* getRasterPointer() {return _rasterPointer;}
float getValue(Position& pos);
float getRasterMaxSize();
diff --git a/bin/CRITERIA3D/criteria3DProject.cpp b/bin/CRITERIA3D/criteria3DProject.cpp
index bcb15f649..20c9c4b44 100644
--- a/bin/CRITERIA3D/criteria3DProject.cpp
+++ b/bin/CRITERIA3D/criteria3DProject.cpp
@@ -1939,7 +1939,7 @@ void Crit3DProject::shadowColor(const Crit3DColor &colorIn, Crit3DColor &colorOu
}
-bool Crit3DProject::update3DColors()
+bool Crit3DProject::update3DColors(gis::Crit3DRasterGrid *rasterPointer)
{
if (openGlGeometry == nullptr)
{
@@ -1947,9 +1947,10 @@ bool Crit3DProject::update3DColors()
return false;
}
- float z1, z2, z3;
+ float z1, z2, z3, value;
Crit3DColor *c1, *c2, *c3;
Crit3DColor sc1, sc2, sc3;
+
long i = 0;
for (long row = 0; row < DEM.header->nrRows; row++)
{
@@ -1958,18 +1959,38 @@ bool Crit3DProject::update3DColors()
z1 = DEM.getValueFromRowCol(row, col);
if (! isEqual(z1, DEM.header->flag))
{
- c1 = DEM.colorScale->getColor(z1);
- shadowColor(*c1, sc1, row, col);
z3 = DEM.getValueFromRowCol(row+1, col+1);
if (! isEqual(z3, DEM.header->flag))
{
+ c1 = DEM.colorScale->getColor(z1);
c3 = DEM.colorScale->getColor(z3);
+
+ if (rasterPointer != nullptr)
+ {
+ value = rasterPointer->getValueFromRowCol(row, col);
+ if (! isEqual(value, rasterPointer->header->flag))
+ c1 = rasterPointer->colorScale->getColor(value);
+
+ value = rasterPointer->getValueFromRowCol(row+1, col+1);
+ if (! isEqual(value, rasterPointer->header->flag))
+ c3 = rasterPointer->colorScale->getColor(value);
+ }
+
+ shadowColor(*c1, sc1, row, col);
shadowColor(*c3, sc3, row+1, col+1);
+
z2 = DEM.getValueFromRowCol(row+1, col);
if (! isEqual(z2, DEM.header->flag))
{
c2 = DEM.colorScale->getColor(z2);
+ if (rasterPointer != nullptr)
+ {
+ value = rasterPointer->getValueFromRowCol(row+1, col);
+ if (! isEqual(value, rasterPointer->header->flag))
+ c2 = rasterPointer->colorScale->getColor(value);
+ }
shadowColor(*c2, sc2, row+1, col);
+
openGlGeometry->setVertexColor(i++, sc1);
openGlGeometry->setVertexColor(i++, sc2);
openGlGeometry->setVertexColor(i++, sc3);
@@ -1979,7 +2000,14 @@ bool Crit3DProject::update3DColors()
if (! isEqual(z2, DEM.header->flag))
{
c2 = DEM.colorScale->getColor(z2);
+ if (rasterPointer != nullptr)
+ {
+ value = rasterPointer->getValueFromRowCol(row, col+1);
+ if (! isEqual(value, rasterPointer->header->flag))
+ c2 = rasterPointer->colorScale->getColor(value);
+ }
shadowColor(*c2, sc2, row, col+1);
+
openGlGeometry->setVertexColor(i++, sc3);
openGlGeometry->setVertexColor(i++, sc2);
openGlGeometry->setVertexColor(i++, sc1);
diff --git a/bin/CRITERIA3D/criteria3DProject.h b/bin/CRITERIA3D/criteria3DProject.h
index f1162e9fc..ba7b627da 100644
--- a/bin/CRITERIA3D/criteria3DProject.h
+++ b/bin/CRITERIA3D/criteria3DProject.h
@@ -115,7 +115,7 @@
void clearGeometry();
bool initializeGeometry();
void shadowColor(const Crit3DColor &colorIn, Crit3DColor &colorOut, int row, int col);
- bool update3DColors();
+ bool update3DColors(gis::Crit3DRasterGrid *rasterPointer = nullptr);
};
diff --git a/bin/CRITERIA3D/mainwindow.cpp b/bin/CRITERIA3D/mainwindow.cpp
index a7752c7ac..63b633d78 100644
--- a/bin/CRITERIA3D/mainwindow.cpp
+++ b/bin/CRITERIA3D/mainwindow.cpp
@@ -200,6 +200,9 @@ void MainWindow::updateOutputMap()
emit rasterOutput->redrawRequested();
outputRasterColorLegend->update();
+
+ refreshViewer3D();
+
qApp->processEvents();
}
@@ -1111,18 +1114,18 @@ void MainWindow::on_variableButton_clicked()
this->updateCurrentVariable();
}
-void MainWindow::setInputRasterVisible(bool value)
+void MainWindow::setInputRasterVisible(bool isVisible)
{
- inputRasterColorLegend->setVisible(value);
- ui->labelInputRaster->setVisible(value);
- rasterDEM->setVisible(value);
+ inputRasterColorLegend->setVisible(isVisible);
+ ui->labelInputRaster->setVisible(isVisible);
+ rasterDEM->setVisible(isVisible);
}
-void MainWindow::setOutputRasterVisible(bool value)
+void MainWindow::setOutputRasterVisible(bool isVisible)
{
- outputRasterColorLegend->setVisible(value);
- ui->labelOutputRaster->setVisible(value);
- rasterOutput->setVisible(value);
+ outputRasterColorLegend->setVisible(isVisible);
+ ui->labelOutputRaster->setVisible(isVisible);
+ rasterOutput->setVisible(isVisible);
}
void MainWindow::setCurrentRasterInput(gis::Crit3DRasterGrid *myRaster)
@@ -1136,18 +1139,39 @@ void MainWindow::setCurrentRasterInput(gis::Crit3DRasterGrid *myRaster)
emit rasterDEM->redrawRequested();
}
-void MainWindow::setCurrentRasterOutput(gis::Crit3DRasterGrid *myRaster)
+
+void MainWindow::refreshViewer3D()
+{
+ if (viewer3D != nullptr)
+ {
+ if (rasterOutput->visible())
+ {
+ myProject.update3DColors(rasterOutput->getRasterPointer());
+ }
+ else
+ {
+ myProject.update3DColors();
+ }
+
+ viewer3D->glWidget->update();
+ }
+}
+
+
+void MainWindow::setCurrentRasterOutput(gis::Crit3DRasterGrid *rasterPointer)
{
setOutputRasterVisible(true);
- rasterOutput->initialize(myRaster, myProject.gisSettings);
- outputRasterColorLegend->colorScale = myRaster->colorScale;
+ rasterOutput->initialize(rasterPointer, myProject.gisSettings);
+ outputRasterColorLegend->colorScale = rasterPointer->colorScale;
emit rasterOutput->redrawRequested();
outputRasterColorLegend->update();
-
rasterOutput->updateCenter();
- view3DVariable = (myRaster == &(myProject.criteria3DMap));
+
+ refreshViewer3D();
+
+ view3DVariable = (rasterPointer == &(myProject.criteria3DMap));
}
@@ -1248,11 +1272,12 @@ void MainWindow::on_actionView_SoilMap_triggered()
}
-void MainWindow::on_actionHide_soil_map_triggered()
+void MainWindow::on_actionHide_Soil_map_triggered()
{
if (ui->labelOutputRaster->text() == "Soil")
{
setOutputRasterVisible(false);
+ refreshViewer3D();
}
}
@@ -1356,9 +1381,16 @@ void MainWindow::showMeteoVariable(meteoVariable var)
}
}
-void MainWindow::on_actionViewMeteoVariable_None_triggered()
+void MainWindow::on_actionView_Radiation_None_triggered()
+{
+ setOutputRasterVisible(false);
+ refreshViewer3D();
+}
+
+void MainWindow::on_actionView_MeteoVariable_None_triggered()
{
setOutputRasterVisible(false);
+ refreshViewer3D();
}
void MainWindow::on_actionView_Air_temperature_triggered()
@@ -1521,7 +1553,8 @@ void MainWindow::on_actionView_Snow_latent_heat_triggered()
// ------------- CROP MAPS ---------------------------------------------------
-void MainWindow::on_actionView_degree_days_triggered()
+
+void MainWindow::on_actionView_Crop_degreeDays_triggered()
{
if (! myProject.isCropInitialized)
{
@@ -3135,6 +3168,8 @@ void MainWindow::on_actionShow_3D_viewer_triggered()
connect (viewer3D, SIGNAL(destroyed()), this, SLOT(on_viewer3DClosed()));
connect (viewer3D, SIGNAL(slopeChanged()), this, SLOT(on_slopeChanged()));
+
+ refreshViewer3D();
}
@@ -3175,6 +3210,7 @@ void MainWindow::on_actionHide_LandUseMap_triggered()
if (ui->labelOutputRaster->text() == "Land use")
{
setOutputRasterVisible(false);
+ refreshViewer3D();
}
}
@@ -3182,18 +3218,19 @@ void MainWindow::on_actionHide_LandUseMap_triggered()
void MainWindow::on_actionHide_Geomap_triggered()
{
setOutputRasterVisible(false);
+ refreshViewer3D();
}
//------------------- MENU VIEW SOIL FLUXES OUTPUT ------------------
-void MainWindow::on_actionView_surfaceWaterContent_automatic_range_triggered()
+void MainWindow::on_actionView_SurfaceWaterContent_automatic_range_triggered()
{
showCriteria3DVariable(volumetricWaterContent, 0, false, 0.1, NODATA);
}
-void MainWindow::on_actionView_surfaceWaterContent_fixed_range_triggered()
+void MainWindow::on_actionView_SurfaceWaterContent_fixed_range_triggered()
{
// choose minimum
float minimum = 0;
@@ -3218,28 +3255,28 @@ void MainWindow::on_actionView_SoilMoisture_triggered()
}
-void MainWindow::on_actionView_degreeOfSaturation_automatic_range_triggered()
+void MainWindow::on_actionView_DegreeOfSaturation_automatic_range_triggered()
{
int layerIndex = ui->layerNrEdit->value();
showCriteria3DVariable(degreeOfSaturation, layerIndex, false, NODATA, NODATA);
}
-void MainWindow::on_actionView_degreeOfSaturation_fixed_range_triggered()
+void MainWindow::on_actionView_DegreeOfSaturation_fixed_range_triggered()
{
int layerIndex = ui->layerNrEdit->value();
showCriteria3DVariable(degreeOfSaturation, layerIndex, true, 0.2, 1.0);
}
-void MainWindow::on_actionView_factor_of_safety_triggered()
+void MainWindow::on_actionView_Factor_of_safety_triggered()
{
int layerIndex = std::max(1, ui->layerNrEdit->value());
showCriteria3DVariable(factorOfSafety, layerIndex, true, 0, 4);
}
-void MainWindow::on_actionView_factor_of_safety_minimum_triggered()
+void MainWindow::on_actionView_Factor_of_safety_minimum_triggered()
{
showCriteria3DVariable(minimumFactorOfSafety, NODATA, true, 0, 4);
}
@@ -3319,11 +3356,11 @@ void MainWindow::on_actionCriteria3D_load_state_triggered()
return;
}
- updateDateTime();
initializeCriteria3DInterface();
+ updateOutputMap();
+
loadMeteoPointsDataSingleDay(myProject.getCurrentDate(), true);
redrawMeteoPoints(currentPointsVisualization, true);
- updateOutputMap();
}
@@ -3367,3 +3404,4 @@ void MainWindow::on_actionCriteria3D_save_state_triggered()
}
+
diff --git a/bin/CRITERIA3D/mainwindow.h b/bin/CRITERIA3D/mainwindow.h
index 514fda6e6..857a88eb1 100644
--- a/bin/CRITERIA3D/mainwindow.h
+++ b/bin/CRITERIA3D/mainwindow.h
@@ -68,6 +68,9 @@
void on_actionView_PointsLocation_triggered();
void on_actionView_PointsCurrentVariable_triggered();
+ void on_actionView_SoilMap_triggered();
+ void on_actionHide_Soil_map_triggered();
+
void on_actionView_Boundary_triggered();
void on_actionView_Slope_triggered();
void on_actionView_Aspect_triggered();
@@ -82,7 +85,8 @@
void on_actionView_Air_relative_humidity_triggered();
void on_actionView_Wind_intensity_triggered();
void on_actionView_ET0_triggered();
- void on_actionViewMeteoVariable_None_triggered();
+ void on_actionView_MeteoVariable_None_triggered();
+ void on_actionView_Radiation_None_triggered();
void on_actionMapOpenStreetMap_triggered();
void on_actionMapESRISatellite_triggered();
@@ -116,6 +120,21 @@
void on_actionView_Snow_age_triggered();
void on_actionView_Snowmelt_triggered();
+ void on_actionView_Snow_sensible_heat_triggered();
+ void on_actionView_Snow_latent_heat_triggered();
+
+ void on_actionView_Crop_LAI_triggered();
+ void on_actionView_Crop_degreeDays_triggered();
+
+ void on_actionView_Factor_of_safety_triggered();
+ void on_actionView_Factor_of_safety_minimum_triggered();
+
+ void on_actionView_DegreeOfSaturation_automatic_range_triggered();
+ void on_actionView_DegreeOfSaturation_fixed_range_triggered();
+
+ void on_actionView_SurfaceWaterContent_automatic_range_triggered();
+ void on_actionView_SurfaceWaterContent_fixed_range_triggered();
+
void on_actionSave_state_triggered();
void on_actionLoad_state_triggered();
void on_flagSave_state_daily_step_toggled(bool isChecked);
@@ -161,8 +180,6 @@
void on_actionOutputPoints_deactivate_selected_triggered();
- void on_actionView_SoilMap_triggered();
-
void on_flagHide_outputPoints_toggled(bool isChecked);
void on_flagView_not_active_outputPoints_toggled(bool isChecked);
@@ -171,8 +188,6 @@
void on_actionOutputPoints_activate_selected_triggered();
- void on_actionHide_soil_map_triggered();
-
void on_actionOutputPoints_newFile_triggered();
void on_actionOutputDB_new_triggered();
@@ -191,10 +206,6 @@
void on_flagView_values_toggled(bool arg1);
- void on_actionView_Snow_sensible_heat_triggered();
-
- void on_actionView_Snow_latent_heat_triggered();
-
void on_actionLoad_external_state_triggered();
void on_actionTopographicDistanceMapWrite_triggered();
@@ -222,22 +233,11 @@
void on_actionWaterFluxes_settings_triggered();
- void on_actionView_Crop_LAI_triggered();
-
- void on_actionView_degree_days_triggered();
-
- void on_actionView_factor_of_safety_triggered();
- void on_actionView_factor_of_safety_minimum_triggered();
-
- void on_actionView_degreeOfSaturation_automatic_range_triggered();
- void on_actionView_degreeOfSaturation_fixed_range_triggered();
- void on_actionView_surfaceWaterContent_automatic_range_triggered();
- void on_actionView_surfaceWaterContent_fixed_range_triggered();
-
void on_flagSave_state_endRun_triggered(bool isChecked);
void on_flag_increase_slope_triggered(bool isChecked);
+
protected:
/*!
* \brief mouseReleaseEvent call moveCenter
@@ -305,9 +305,11 @@
bool loadMeteoPointsDB_GUI(QString dbName);
void setCurrentRasterInput(gis::Crit3DRasterGrid *myRaster);
- void setCurrentRasterOutput(gis::Crit3DRasterGrid *myRaster);
+ void setCurrentRasterOutput(gis::Crit3DRasterGrid *rasterPointer);
void interpolateCurrentVariable();
bool initializeViewer3D();
+ void refreshViewer3D();
+
bool checkMapVariable(bool isComputed);
bool isSoil(QPoint mapPos);
@@ -319,8 +321,8 @@
bool contextMenuRequested(QPoint localPos);
- void setInputRasterVisible(bool value);
- void setOutputRasterVisible(bool value);
+ void setInputRasterVisible(bool isVisible);
+ void setOutputRasterVisible(bool isVisible);
void addMeteoPoints();
void drawWindVector(int i);
diff --git a/bin/CRITERIA3D/mainwindow.ui b/bin/CRITERIA3D/mainwindow.ui
index 2a592ae27..ceed432f8 100644
--- a/bin/CRITERIA3D/mainwindow.ui
+++ b/bin/CRITERIA3D/mainwindow.ui
@@ -1293,7 +1293,7 @@
0
1752
9
- 18
+ 17
@@ -2025,7 +2025,7 @@
-
+
@@ -2100,19 +2102,19 @@
-
-
+
None
@@ -2751,7 +2753,7 @@
View not active
-
+
Hide map
@@ -2850,7 +2852,7 @@
Soil moisture
-
+
false
@@ -2858,7 +2860,7 @@
Automatic range
-
+
false
@@ -2866,7 +2868,7 @@
Fixed range
-
+
Degree days
@@ -2884,17 +2886,17 @@
Update sub hourly
-
+
Factor of safety (current depth)
-
+
Automatic range
-
+
Fixed range
@@ -2914,7 +2916,7 @@
Save state
-
+
Factor of safety (minimum value)
@@ -2935,6 +2937,11 @@
increase slope
+
+
+ None
+
+