#2438 2D Intersection View: 3D Info Box items must follow settings in the main view

This commit is contained in:
Rebecca Cox
2018-02-15 13:00:33 +01:00
parent de498a71c2
commit 1076384ce0
4 changed files with 156 additions and 82 deletions

View File

@@ -333,16 +333,29 @@ void Rim2dIntersectionView::updateCurrentTimeStep()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::updateLegends() void Rim2dIntersectionView::updateLegends()
{ {
if (m_viewer) if (!m_viewer)
{ {
m_viewer->removeAllColorLegends(); return;
} }
m_viewer->removeAllColorLegends();
if (!hasResults()) return; if (!hasResults()) return;
QString overlayInfoText; QString overlayInfoText;
overlayInfoText += "<b>--" + ownerCase()->caseUserDescription() + "--</b>"; RimEclipseView * eclView = nullptr;
m_intersection->firstAncestorOrThisOfType(eclView);
if (eclView && eclView->overlayInfoConfig()->showCaseInfo())
{
overlayInfoText += "<b>--" + ownerCase()->caseUserDescription() + "--</b>";
}
RimGeoMechView * geoView = nullptr;
m_intersection->firstAncestorOrThisOfType(geoView);
if (geoView && geoView->overlayInfoConfig()->showCaseInfo())
{
overlayInfoText += "<b>--" + ownerCase()->caseUserDescription() + "--</b>";
}
overlayInfoText += "<p>"; overlayInfoText += "<p>";
overlayInfoText += "<b>Intersection:</b> " + m_intersection->name() + "<br>"; overlayInfoText += "<b>Intersection:</b> " + m_intersection->name() + "<br>";
@@ -358,15 +371,24 @@ void Rim2dIntersectionView::updateLegends()
cvf::OverlayItem* legend = nullptr; cvf::OverlayItem* legend = nullptr;
RimEclipseView * eclView = nullptr;
m_intersection->firstAncestorOrThisOfType(eclView);
if (eclView) if (eclView)
{ {
overlayInfoText += "<b>Cell Result:</b> " + eclView->cellResult()->resultVariableUiShortName() + "<br>"; if (eclView->overlayInfoConfig()->showAnimProgress())
{
m_viewer->showAnimationProgress(true);
}
else
{
m_viewer->showAnimationProgress(false);
}
if (eclView->overlayInfoConfig()->showResultInfo())
{
overlayInfoText += "<b>Cell Result:</b> " + eclView->cellResult()->resultVariableUiShortName() + "<br>";
}
m_legendConfig()->setUiValuesFromLegendConfig(eclView->cellResult()->legendConfig()); m_legendConfig()->setUiValuesFromLegendConfig(eclView->cellResult()->legendConfig());
m_ternaryLegendConfig()->setUiValuesFromLegendConfig(eclView->cellResult()->ternaryLegendConfig()); m_ternaryLegendConfig()->setUiValuesFromLegendConfig(eclView->cellResult()->ternaryLegendConfig());
eclView->cellResult()->updateLegendData(m_currentTimeStep(), m_legendConfig(), m_ternaryLegendConfig());
if ( eclView->cellResult()->isTernarySaturationSelected() ) if ( eclView->cellResult()->isTernarySaturationSelected() )
{ {
@@ -380,41 +402,51 @@ void Rim2dIntersectionView::updateLegends()
} }
} }
RimGeoMechView * geoView = nullptr;
m_intersection->firstAncestorOrThisOfType(geoView);
if (geoView) if (geoView)
{ {
QString resultPos; if (geoView->overlayInfoConfig()->showAnimProgress())
QString fieldName = geoView->cellResultResultDefinition()->resultFieldUiName();
QString compName = geoView->cellResultResultDefinition()->resultComponentUiName();
switch (geoView->cellResultResultDefinition()->resultPositionType())
{ {
case RIG_NODAL: m_viewer->showAnimationProgress(true);
resultPos = "Nodal";
break;
case RIG_ELEMENT_NODAL:
resultPos = "Element nodal";
break;
case RIG_INTEGRATION_POINT:
resultPos = "Integration point";
break;
case RIG_ELEMENT:
resultPos = "Element";
break;
default:
break;
}
if (compName == "")
{
overlayInfoText += QString("<b>Cell result:</b> %1, %2<br>").arg(resultPos).arg(fieldName);
} }
else else
{ {
overlayInfoText += QString("<b>Cell result:</b> %1, %2, %3<br>").arg(resultPos).arg(fieldName).arg(compName); m_viewer->showAnimationProgress(false);
}
if (geoView->overlayInfoConfig()->showResultInfo())
{
QString resultPos;
QString fieldName = geoView->cellResultResultDefinition()->resultFieldUiName();
QString compName = geoView->cellResultResultDefinition()->resultComponentUiName();
switch (geoView->cellResultResultDefinition()->resultPositionType())
{
case RIG_NODAL:
resultPos = "Nodal";
break;
case RIG_ELEMENT_NODAL:
resultPos = "Element nodal";
break;
case RIG_INTEGRATION_POINT:
resultPos = "Integration point";
break;
case RIG_ELEMENT:
resultPos = "Element";
break;
default:
break;
}
if (compName == "")
{
overlayInfoText += QString("<b>Cell result:</b> %1, %2<br>").arg(resultPos).arg(fieldName);
}
else
{
overlayInfoText += QString("<b>Cell result:</b> %1, %2, %3<br>").arg(resultPos).arg(fieldName).arg(compName);
}
} }
m_legendConfig()->setUiValuesFromLegendConfig(geoView->cellResult()->legendConfig()); m_legendConfig()->setUiValuesFromLegendConfig(geoView->cellResult()->legendConfig());

View File

@@ -56,6 +56,8 @@ public:
virtual bool isTimeStepDependentDataVisible() const override; virtual bool isTimeStepDependentDataVisible() const override;
void updateLegends();
protected: protected:
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) override; virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) override;
@@ -78,7 +80,6 @@ protected:
bool hasResults(); bool hasResults();
int timeStepCount(); int timeStepCount();
void updateLegends();
caf::PdmChildField<RimLegendConfig*> m_legendConfig; caf::PdmChildField<RimLegendConfig*> m_legendConfig;
caf::PdmChildField<RimTernaryLegendConfig*> m_ternaryLegendConfig; caf::PdmChildField<RimTernaryLegendConfig*> m_ternaryLegendConfig;

View File

@@ -35,6 +35,10 @@
#include "RigMainGrid.h" #include "RigMainGrid.h"
#include "RigStatisticsDataCache.h" #include "RigStatisticsDataCache.h"
#include "Rim2dIntersectionView.h"
#include "Rim2dIntersectionViewCollection.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
@@ -47,7 +51,6 @@
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RimSimWellInViewCollection.h" #include "RimSimWellInViewCollection.h"
#include "Rim3dView.h"
#include "RimTools.h" #include "RimTools.h"
#include "RiuViewer.h" #include "RiuViewer.h"
@@ -92,14 +95,14 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
{ {
CAF_PDM_InitObject("Info Box", ":/InfoBox16x16.png", "", ""); CAF_PDM_InitObject("Info Box", ":/InfoBox16x16.png", "", "");
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", ""); CAF_PDM_InitField(&m_active, "Active", true, "Active", "", "", "");
active.uiCapability()->setUiHidden(true); m_active.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", ""); CAF_PDM_InitField(&m_showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "");
CAF_PDM_InitField(&showCaseInfo, "ShowInfoText", true, "Case Info", "", "", ""); CAF_PDM_InitField(&m_showCaseInfo, "ShowInfoText", true, "Case Info", "", "", "");
CAF_PDM_InitField(&showResultInfo, "ShowResultInfo", true, "Result Info", "", "", ""); CAF_PDM_InitField(&m_showResultInfo, "ShowResultInfo", true, "Result Info", "", "", "");
CAF_PDM_InitField(&showHistogram, "ShowHistogram", true, "Histogram", "", "", ""); CAF_PDM_InitField(&m_showHistogram, "ShowHistogram", true, "Histogram", "", "", "");
CAF_PDM_InitField(&showVolumeWeightedMean, "ShowVolumeWeightedMean", true, "Mobile Volume Weighted Mean", "", "", ""); CAF_PDM_InitField(&m_showVolumeWeightedMean, "ShowVolumeWeightedMean", true, "Mobile Volume Weighted Mean", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", "");
@@ -131,17 +134,17 @@ void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
if ( changedField == &m_statisticsCellRange ) m_statisticsCellRange = ALL_CELLS; if ( changedField == &m_statisticsCellRange ) m_statisticsCellRange = ALL_CELLS;
} }
if (changedField == &showResultInfo) if (changedField == &m_showResultInfo)
{ {
if (!showResultInfo()) if (!m_showResultInfo())
{ {
showVolumeWeightedMean = false; m_showVolumeWeightedMean = false;
showVolumeWeightedMean.uiCapability()->setUiReadOnly(true); m_showVolumeWeightedMean.uiCapability()->setUiReadOnly(true);
} }
else else
{ {
showVolumeWeightedMean = true; m_showVolumeWeightedMean = true;
showVolumeWeightedMean.uiCapability()->setUiReadOnly(false); m_showVolumeWeightedMean.uiCapability()->setUiReadOnly(false);
} }
} }
@@ -209,7 +212,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData)
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p()); auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p()); auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (eclipseView) return resultInfoText(histData, eclipseView, showVolumeWeightedMean()); if (eclipseView) return resultInfoText(histData, eclipseView, m_showVolumeWeightedMean());
if (geoMechView) return resultInfoText(histData, geoMechView); if (geoMechView) return resultInfoText(histData, geoMechView);
return ""; return "";
} }
@@ -226,6 +229,30 @@ QImage Rim3dOverlayInfoConfig::statisticsDialogScreenShotImage()
return QImage(); return QImage();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dOverlayInfoConfig::showAnimProgress()
{
return m_showAnimProgress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dOverlayInfoConfig::showCaseInfo()
{
return m_showCaseInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dOverlayInfoConfig::showResultInfo()
{
return m_showResultInfo;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -654,7 +681,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
if (!m_viewDef) return; if (!m_viewDef) return;
if (!m_viewDef->viewer()) return; if (!m_viewDef->viewer()) return;
if (!this->active()) if (!this->m_active())
{ {
m_viewDef->viewer()->showInfoText(false); m_viewDef->viewer()->showInfoText(false);
m_viewDef->viewer()->showHistogram(false); m_viewDef->viewer()->showHistogram(false);
@@ -663,9 +690,9 @@ void Rim3dOverlayInfoConfig::update3DInfo()
return; return;
} }
m_viewDef->viewer()->showInfoText(showCaseInfo() || showResultInfo()); m_viewDef->viewer()->showInfoText(m_showCaseInfo() || m_showResultInfo());
m_viewDef->viewer()->showHistogram(false); m_viewDef->viewer()->showHistogram(false);
m_viewDef->viewer()->showAnimationProgress(showAnimProgress()); m_viewDef->viewer()->showAnimationProgress(m_showAnimProgress());
m_isVisCellStatUpToDate = false; m_isVisCellStatUpToDate = false;
@@ -687,13 +714,23 @@ void Rim3dOverlayInfoConfig::update3DInfo()
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p()); RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (geoMechView) if (geoMechView)
{ {
showVolumeWeightedMean = false; m_showVolumeWeightedMean = false;
updateGeoMech3DInfo(geoMechView); updateGeoMech3DInfo(geoMechView);
// Update statistics dialog // Update statistics dialog
m_gridStatisticsDialog->updateFromRimView(geoMechView); m_gridStatisticsDialog->updateFromRimView(geoMechView);
} }
RimCase* rimCase;
firstAncestorOrThisOfType(rimCase);
if (rimCase)
{
for (Rim2dIntersectionView* view : rimCase->intersectionViewCollection()->views())
{
view->updateLegends();
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -701,7 +738,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField() caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField()
{ {
return &active; return &m_active;
} }
@@ -712,16 +749,16 @@ void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
{ {
caf::PdmUiGroup* visGroup = uiOrdering.addNewGroup("Visibility"); caf::PdmUiGroup* visGroup = uiOrdering.addNewGroup("Visibility");
visGroup->add(&showAnimProgress); visGroup->add(&m_showAnimProgress);
visGroup->add(&showCaseInfo); visGroup->add(&m_showCaseInfo);
visGroup->add(&showResultInfo); visGroup->add(&m_showResultInfo);
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p()); RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (!geoMechView) if (!geoMechView)
{ {
visGroup->add(&showVolumeWeightedMean); visGroup->add(&m_showVolumeWeightedMean);
} }
visGroup->add(&showHistogram); visGroup->add(&m_showHistogram);
caf::PdmUiGroup* statGroup = uiOrdering.addNewGroup("Statistics Options"); caf::PdmUiGroup* statGroup = uiOrdering.addNewGroup("Statistics Options");
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p()); RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
@@ -750,19 +787,19 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
{ {
HistogramData histData; HistogramData histData;
if (showHistogram() || showResultInfo()) if (m_showHistogram() || m_showResultInfo())
{ {
histData = histogramData(); histData = histogramData();
} }
QString infoText; QString infoText;
if (showCaseInfo()) if (m_showCaseInfo())
{ {
infoText = caseInfoText(); infoText = caseInfoText();
} }
if (showResultInfo()) if (m_showResultInfo())
{ {
infoText += resultInfoText(histData); infoText += resultInfoText(histData);
} }
@@ -772,7 +809,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
eclipseView->viewer()->setInfoText(infoText); eclipseView->viewer()->setInfoText(infoText);
} }
if (showHistogram()) if (m_showHistogram())
{ {
bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult(); bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult();
@@ -792,7 +829,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
{ {
HistogramData histData; HistogramData histData;
if (showResultInfo() || showHistogram()) if (m_showResultInfo() || m_showHistogram())
{ {
histData = histogramData(geoMechView); histData = histogramData(geoMechView);
} }
@@ -801,12 +838,12 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
QString infoText; QString infoText;
if (showCaseInfo()) if (m_showCaseInfo())
{ {
infoText = caseInfoText(geoMechView); infoText = caseInfoText(geoMechView);
} }
if (showResultInfo()) if (m_showResultInfo())
{ {
infoText += resultInfoText(histData, geoMechView); infoText += resultInfoText(histData, geoMechView);
} }
@@ -818,7 +855,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
// Populate histogram // Populate histogram
if (showHistogram()) if (m_showHistogram())
{ {
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr; RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;

View File

@@ -71,13 +71,17 @@ public:
void setPosition(cvf::Vec2ui position); void setPosition(cvf::Vec2ui position);
HistogramData histogramData(); HistogramData histogramData();
QString timeStepText(); QString timeStepText();
QString caseInfoText(); QString caseInfoText();
QString resultInfoText(const HistogramData& histData); QString resultInfoText(const HistogramData& histData);
void showStatisticsInfoDialog(bool raise = true); void showStatisticsInfoDialog(bool raise = true);
QImage statisticsDialogScreenShotImage(); QImage statisticsDialogScreenShotImage();
bool showAnimProgress();
bool showCaseInfo();
bool showResultInfo();
enum StatisticsTimeRangeType enum StatisticsTimeRangeType
{ {
@@ -110,12 +114,12 @@ private:
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean); QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean);
QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView); QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView);
caf::PdmField<bool> active; caf::PdmField<bool> m_active;
caf::PdmField<bool> showAnimProgress; caf::PdmField<bool> m_showAnimProgress;
caf::PdmField<bool> showCaseInfo; caf::PdmField<bool> m_showCaseInfo;
caf::PdmField<bool> showResultInfo; caf::PdmField<bool> m_showResultInfo;
caf::PdmField<bool> showVolumeWeightedMean; caf::PdmField<bool> m_showVolumeWeightedMean;
caf::PdmField<bool> showHistogram; caf::PdmField<bool> m_showHistogram;
caf::PdmField<caf::AppEnum<StatisticsTimeRangeType> > m_statisticsTimeRange; caf::PdmField<caf::AppEnum<StatisticsTimeRangeType> > m_statisticsTimeRange;
caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange; caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange;