#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()
{
if (m_viewer)
if (!m_viewer)
{
m_viewer->removeAllColorLegends();
return;
}
m_viewer->removeAllColorLegends();
if (!hasResults()) return;
QString overlayInfoText;
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 += "<b>Intersection:</b> " + m_intersection->name() + "<br>";
@@ -358,15 +371,24 @@ void Rim2dIntersectionView::updateLegends()
cvf::OverlayItem* legend = nullptr;
RimEclipseView * eclView = nullptr;
m_intersection->firstAncestorOrThisOfType(eclView);
if (eclView)
{
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_ternaryLegendConfig()->setUiValuesFromLegendConfig(eclView->cellResult()->ternaryLegendConfig());
eclView->cellResult()->updateLegendData(m_currentTimeStep(), m_legendConfig(), m_ternaryLegendConfig());
if ( eclView->cellResult()->isTernarySaturationSelected() )
{
@@ -380,9 +402,18 @@ void Rim2dIntersectionView::updateLegends()
}
}
RimGeoMechView * geoView = nullptr;
m_intersection->firstAncestorOrThisOfType(geoView);
if (geoView)
{
if (geoView->overlayInfoConfig()->showAnimProgress())
{
m_viewer->showAnimationProgress(true);
}
else
{
m_viewer->showAnimationProgress(false);
}
if (geoView->overlayInfoConfig()->showResultInfo())
{
QString resultPos;
QString fieldName = geoView->cellResultResultDefinition()->resultFieldUiName();
@@ -416,6 +447,7 @@ void Rim2dIntersectionView::updateLegends()
{
overlayInfoText += QString("<b>Cell result:</b> %1, %2, %3<br>").arg(resultPos).arg(fieldName).arg(compName);
}
}
m_legendConfig()->setUiValuesFromLegendConfig(geoView->cellResult()->legendConfig());

View File

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

View File

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

View File

@@ -79,6 +79,10 @@ public:
void showStatisticsInfoDialog(bool raise = true);
QImage statisticsDialogScreenShotImage();
bool showAnimProgress();
bool showCaseInfo();
bool showResultInfo();
enum StatisticsTimeRangeType
{
ALL_TIMESTEPS,
@@ -110,12 +114,12 @@ private:
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean);
QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView);
caf::PdmField<bool> active;
caf::PdmField<bool> showAnimProgress;
caf::PdmField<bool> showCaseInfo;
caf::PdmField<bool> showResultInfo;
caf::PdmField<bool> showVolumeWeightedMean;
caf::PdmField<bool> showHistogram;
caf::PdmField<bool> m_active;
caf::PdmField<bool> m_showAnimProgress;
caf::PdmField<bool> m_showCaseInfo;
caf::PdmField<bool> m_showResultInfo;
caf::PdmField<bool> m_showVolumeWeightedMean;
caf::PdmField<bool> m_showHistogram;
caf::PdmField<caf::AppEnum<StatisticsTimeRangeType> > m_statisticsTimeRange;
caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange;