mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2426 Add working legends to 2D intersection Views. Refactor to make legend update code work from a separate view with separate legend configs. Make sure legend and results are updated as the main view is updated. Adjust legendconfig->setTitle to use QString
This commit is contained in:
@@ -101,7 +101,9 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(), timeStepIndex);
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors,
|
||||
cellResultColors->ternaryLegendConfig()->scalarMapper(),
|
||||
timeStepIndex);
|
||||
|
||||
texturer.createTextureCoords(m_intersectionBoxFacesTextureCoords.p(), m_intersectionBoxGenerator->triangleToCellIndex());
|
||||
|
||||
|
||||
@@ -89,8 +89,12 @@ void RivIntersectionPartMgr::applySingleColorEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex,
|
||||
const cvf::ScalarMapper* scalarColorMapper,
|
||||
const RivTernaryScalarMapper* ternaryColorMapper)
|
||||
{
|
||||
CVF_ASSERT(scalarColorMapper);
|
||||
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
if (!m_crossSectionGenerator->isAnyGeometryPresent()) return;
|
||||
@@ -102,6 +106,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
|
||||
CVF_ASSERT(cellResultColors);
|
||||
CVF_ASSERT(ternaryColorMapper);
|
||||
|
||||
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
|
||||
|
||||
@@ -110,14 +115,13 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(), timeStepIndex);
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, ternaryColorMapper, timeStepIndex);
|
||||
|
||||
texturer.createTextureCoords(m_crossSectionFacesTextureCoords.p(), m_crossSectionGenerator->triangleToCellIndex());
|
||||
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
ternaryColorMapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
@@ -126,7 +130,6 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionGenerator.notNull());
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
cvf::ref<RigResultAccessor> resultAccessor;
|
||||
|
||||
if (RiaDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
|
||||
@@ -144,12 +147,12 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
RivIntersectionPartMgr::calculateEclipseTextureCoordinates(m_crossSectionFacesTextureCoords.p(),
|
||||
m_crossSectionGenerator->triangleToCellIndex(),
|
||||
resultAccessor.p(),
|
||||
mapper);
|
||||
scalarColorMapper);
|
||||
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
scalarColorMapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
@@ -169,8 +172,6 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
|
||||
RigFemResultAddress resVarAddress = cellResultColors->resultAddress();
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
if (resVarAddress.resultPosType == RIG_ELEMENT)
|
||||
{
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, 0, (int)timeStepIndex);
|
||||
@@ -179,7 +180,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
RivIntersectionPartMgr::calculateElementBasedGeoMechTextureCoords(m_crossSectionFacesTextureCoords.p(),
|
||||
resultValues,
|
||||
triangleToCellIdx,
|
||||
mapper);
|
||||
scalarColorMapper);
|
||||
|
||||
}
|
||||
else if(resVarAddress.resultPosType == RIG_ELEMENT_NODAL_FACE)
|
||||
@@ -192,7 +193,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
RivIntersectionPartMgr::calculatePlaneAngleTextureCoords(m_crossSectionFacesTextureCoords.p(),
|
||||
triangelVxes,
|
||||
resVarAddress,
|
||||
mapper);
|
||||
scalarColorMapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,7 +205,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
caseData,
|
||||
resVarAddress,
|
||||
(int)timeStepIndex,
|
||||
mapper);
|
||||
scalarColorMapper);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -222,12 +223,12 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
resultValues,
|
||||
isElementNodalResult,
|
||||
femPart,
|
||||
mapper);
|
||||
scalarColorMapper);
|
||||
}
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
scalarColorMapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
geoView->isLightingDisabled());
|
||||
|
||||
@@ -43,6 +43,7 @@ class RigResultAccessor;
|
||||
class RimCellEdgeColors;
|
||||
class RimEclipseCellColors;
|
||||
class RimIntersection;
|
||||
class RivTernaryScalarMapper;
|
||||
class RivIntersectionGeometryGenerator;
|
||||
class RivIntersectionHexGridInterface;
|
||||
class RivIntersectionVertexWeights;
|
||||
@@ -59,7 +60,9 @@ public:
|
||||
explicit RivIntersectionPartMgr(RimIntersection* rimCrossSection, bool isFlattened = false);
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
void updateCellResultColor(size_t timeStepIndex,
|
||||
const cvf::ScalarMapper* scalarColorMapper,
|
||||
const RivTernaryScalarMapper* ternaryColorMapper);
|
||||
|
||||
|
||||
void appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
@@ -87,7 +87,7 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGe
|
||||
RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
|
||||
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
const RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -79,7 +79,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig,
|
||||
const RivTernaryScalarMapper* ternaryColorMapper,
|
||||
size_t timeStepIndex)
|
||||
: m_quadMapper(NULL)
|
||||
{
|
||||
@@ -99,10 +99,8 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
m_resultAccessor = new RigTernaryResultAccessor();
|
||||
m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p());
|
||||
|
||||
const RivTernaryScalarMapper* mapper = ternaryLegendConfig->scalarMapper();
|
||||
|
||||
// Create a texture mapper without detecting transparency using RigPipeInCellEvaluator
|
||||
m_texMapper = new RivTernaryResultToTextureMapper(mapper, NULL);
|
||||
m_texMapper = new RivTernaryResultToTextureMapper(ternaryColorMapper, NULL);
|
||||
CVF_ASSERT(m_texMapper.notNull());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
|
||||
|
||||
RivTernaryTextureCoordsCreator( RimEclipseCellColors* cellResultColors,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig,
|
||||
const RivTernaryScalarMapper* ternaryColorMapper,
|
||||
size_t timeStepIndex);
|
||||
|
||||
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RiuViewer.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
#include "RivTernarySaturationOverlayItem.h"
|
||||
|
||||
#include "cvfPart.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
@@ -32,6 +33,8 @@
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
@@ -52,6 +55,18 @@ Rim2dIntersectionView::Rim2dIntersectionView(void)
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersection, "Intersection", "Intersection", ":/CrossSection16x16.png", "", "");
|
||||
m_intersection.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
||||
m_legendConfig.uiCapability()->setUiHidden(true);
|
||||
m_legendConfig.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
m_legendConfig.xmlCapability()->disableIO();
|
||||
m_legendConfig = new RimLegendConfig();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Legend Definition", "", "", "");
|
||||
m_ternaryLegendConfig.uiCapability()->setUiTreeHidden(true);
|
||||
m_ternaryLegendConfig.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
m_ternaryLegendConfig.xmlCapability()->disableIO();
|
||||
m_ternaryLegendConfig = new RimTernaryLegendConfig();
|
||||
|
||||
m_showWindow = false;
|
||||
m_scaleTransform = new cvf::Transform();
|
||||
m_intersectionVizModel = new cvf::ModelBasicList;
|
||||
@@ -274,6 +289,12 @@ void Rim2dIntersectionView::createDisplayModel()
|
||||
void Rim2dIntersectionView::createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts)
|
||||
{
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::onTimeStepChanged()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -287,23 +308,88 @@ void Rim2dIntersectionView::clampCurrentTimestep()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::updateCurrentTimeStep()
|
||||
{
|
||||
updateLegends();
|
||||
|
||||
if ((this->hasUserRequestedAnimation() && this->hasResults()))
|
||||
{
|
||||
m_flatIntersectionPartMgr->updateCellResultColor(m_currentTimeStep);
|
||||
m_flatIntersectionPartMgr->updateCellResultColor(m_currentTimeStep,
|
||||
m_legendConfig->scalarMapper(),
|
||||
m_ternaryLegendConfig()->scalarMapper());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flatIntersectionPartMgr->applySingleColorEffect();
|
||||
}
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::updateLegends()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
m_viewer->removeAllColorLegends();
|
||||
}
|
||||
|
||||
if (!hasResults()) return ;
|
||||
|
||||
cvf::OverlayItem* legend = nullptr;
|
||||
|
||||
RimEclipseView * eclView = nullptr;
|
||||
m_intersection->firstAncestorOrThisOfType(eclView);
|
||||
if (eclView)
|
||||
{
|
||||
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() )
|
||||
{
|
||||
m_ternaryLegendConfig()->setTitle("Cell Result:");
|
||||
legend = m_ternaryLegendConfig()->legend();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_legendConfig()->setTitle("Cell Result:" + eclView->cellResult()->resultVariableUiShortName());
|
||||
legend = m_legendConfig()->legend();
|
||||
}
|
||||
}
|
||||
|
||||
RimGeoMechView * geoView = nullptr;
|
||||
m_intersection->firstAncestorOrThisOfType(geoView);
|
||||
if (geoView)
|
||||
{
|
||||
m_legendConfig()->setUiValuesFromLegendConfig(geoView->cellResult()->legendConfig());
|
||||
|
||||
geoView->updateLegendTextAndRanges(m_legendConfig(), m_currentTimeStep());
|
||||
legend = m_legendConfig()->legend();
|
||||
}
|
||||
|
||||
if ( legend )
|
||||
{
|
||||
m_viewer->addColorLegendToBottomLeftCorner(legend);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::onTimeStepChanged()
|
||||
void Rim2dIntersectionView::resetLegendsInViewer()
|
||||
{
|
||||
m_viewer->showAxisCross(false);
|
||||
m_viewer->showAnimationProgress(true);
|
||||
m_viewer->showHistogram(false);
|
||||
m_viewer->showInfoText(false);
|
||||
|
||||
m_viewer->setMainScene(new cvf::Scene());
|
||||
m_viewer->enableNavigationRotation(false);
|
||||
|
||||
m_ternaryLegendConfig()->recreateLegend();
|
||||
m_legendConfig()->recreateLegend();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -332,20 +418,6 @@ cvf::Transform* Rim2dIntersectionView::scaleTransform()
|
||||
return m_scaleTransform.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::resetLegendsInViewer()
|
||||
{
|
||||
m_viewer->showAxisCross(false);
|
||||
m_viewer->showAnimationProgress(true);
|
||||
m_viewer->showHistogram(false);
|
||||
m_viewer->showInfoText(false);
|
||||
|
||||
m_viewer->setMainScene(new cvf::Scene());
|
||||
m_viewer->enableNavigationRotation(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
class RimIntersection;
|
||||
class RivIntersectionPartMgr;
|
||||
class RimLegendConfig;
|
||||
class RimTernaryLegendConfig;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -76,6 +78,11 @@ protected:
|
||||
bool hasResults();
|
||||
int timeStepCount();
|
||||
|
||||
void updateLegends();
|
||||
|
||||
caf::PdmChildField<RimLegendConfig*> m_legendConfig;
|
||||
caf::PdmChildField<RimTernaryLegendConfig*> m_ternaryLegendConfig;
|
||||
|
||||
caf::PdmPtrField<RimIntersection*> m_intersection;
|
||||
|
||||
cvf::ref<RivIntersectionPartMgr> m_flatIntersectionPartMgr;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
@@ -398,6 +399,7 @@ void RimEclipseCase::updateFormationNamesData()
|
||||
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
eclView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,9 +273,16 @@ public :
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
|
||||
RimLegendConfig* legendConfig,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig)
|
||||
{
|
||||
if (this->isFlowDiagOrInjectionFlooding())
|
||||
if (!legendConfig) legendConfig = this->legendConfig();
|
||||
if (!ternaryLegendConfig) ternaryLegendConfig = this->ternaryLegendConfig();
|
||||
|
||||
if ( this->hasResult() )
|
||||
{
|
||||
if ( this->isFlowDiagOrInjectionFlooding() )
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
@@ -289,7 +296,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if (this->hasDynamicResult())
|
||||
if ( this->hasDynamicResult() )
|
||||
{
|
||||
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &localMin, &localMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
||||
@@ -303,36 +310,37 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->legendConfig());
|
||||
CVF_ASSERT(legendConfig);
|
||||
|
||||
this->legendConfig()->disableAllTimeStepsRange(true);
|
||||
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
legendConfig->disableAllTimeStepsRange(true);
|
||||
legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero,
|
||||
localPosClosestToZero, localNegClosestToZero);
|
||||
legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
if ( this->hasCategoryResult() )
|
||||
{
|
||||
std::set<std::tuple<QString, int, cvf::Color3ub>, TupleCompare > categories;
|
||||
//std::set<std::tuple<QString, int, cvf::Color3ub> > categories;
|
||||
|
||||
std::vector<QString> tracerNames = this->flowDiagSolution()->tracerNames();
|
||||
int tracerIndex = 0;
|
||||
for (const auto& tracerName : tracerNames)
|
||||
for ( const auto& tracerName : tracerNames )
|
||||
{
|
||||
RimSimWellInView* well = m_reservoirView->wellCollection()->findWell(RimFlowDiagSolution::removeCrossFlowEnding(tracerName));
|
||||
cvf::Color3ub color(cvf::Color3::GRAY);
|
||||
if (well) color = cvf::Color3ub(well->wellPipeColor());
|
||||
if ( well ) color = cvf::Color3ub(well->wellPipeColor());
|
||||
|
||||
categories.insert(std::make_tuple(tracerName, tracerIndex, color));
|
||||
++tracerIndex;
|
||||
}
|
||||
|
||||
std::vector<std::tuple<QString, int, cvf::Color3ub>> reverseCategories;
|
||||
for (auto tupIt = categories.rbegin(); tupIt != categories.rend(); ++tupIt)
|
||||
for ( auto tupIt = categories.rbegin(); tupIt != categories.rend(); ++tupIt )
|
||||
{
|
||||
reverseCategories.push_back(*tupIt);
|
||||
}
|
||||
|
||||
this->legendConfig()->setCategoryItems(reverseCategories);
|
||||
legendConfig->setCategoryItems(reverseCategories);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -340,11 +348,11 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseCase);
|
||||
CVF_ASSERT(rimEclipseCase);
|
||||
if (!rimEclipseCase) return;
|
||||
if ( !rimEclipseCase ) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
|
||||
CVF_ASSERT(eclipseCase);
|
||||
if (!eclipseCase) return;
|
||||
if ( !eclipseCase ) return;
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = eclipseCase->results(this->porosityModel());
|
||||
CVF_ASSERT(cellResultsData);
|
||||
@@ -356,7 +364,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if (this->hasDynamicResult())
|
||||
if ( this->hasDynamicResult() )
|
||||
{
|
||||
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), currentTimeStep, localMin, localMax);
|
||||
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), currentTimeStep, localPosClosestToZero, localNegClosestToZero);
|
||||
@@ -370,20 +378,20 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->legendConfig());
|
||||
CVF_ASSERT(legendConfig);
|
||||
|
||||
this->legendConfig()->disableAllTimeStepsRange(false);
|
||||
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
legendConfig->disableAllTimeStepsRange(false);
|
||||
legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
if ( this->hasCategoryResult() )
|
||||
{
|
||||
if (this->resultType() == RiaDefines::FORMATION_NAMES)
|
||||
if ( this->resultType() == RiaDefines::FORMATION_NAMES )
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
this->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
legendConfig->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
else if (this->resultType() == RiaDefines::DYNAMIC_NATIVE && this->resultVariable() == RiaDefines::completionTypeResultName())
|
||||
else if ( this->resultType() == RiaDefines::DYNAMIC_NATIVE && this->resultVariable() == RiaDefines::completionTypeResultName() )
|
||||
{
|
||||
std::vector< std::tuple<QString, int, cvf::Color3ub> > categories;
|
||||
|
||||
@@ -397,11 +405,80 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
categories.push_back(std::make_tuple(perforationInterval.uiText(), static_cast<int>(perforationInterval.index()), cvf::Color3::GREEN));
|
||||
categories.push_back(std::make_tuple(fracture.uiText(), static_cast<int>(fracture.index()), cvf::Color3::YELLOW_GREEN));
|
||||
|
||||
legendConfig()->setCategoryItems(categories);
|
||||
legendConfig->setCategoryItems(categories);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(this->scalarResultIndex()));
|
||||
legendConfig->setIntegerCategories(cellResultsData->uniqueCellScalarValues(this->scalarResultIndex()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ternary legend update
|
||||
{
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseCase);
|
||||
CVF_ASSERT(rimEclipseCase);
|
||||
if ( !rimEclipseCase ) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
|
||||
CVF_ASSERT(eclipseCase);
|
||||
if ( !eclipseCase ) return;
|
||||
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = eclipseCase->results(this->porosityModel());
|
||||
|
||||
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
|
||||
if ( this->isTernarySaturationSelected() && maxTimeStepCount > 1 )
|
||||
{
|
||||
RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
|
||||
{
|
||||
size_t scalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
if ( scalarSetIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
double globalMin = 0.0;
|
||||
double globalMax = 1.0;
|
||||
double localMin = 0.0;
|
||||
double localMax = 1.0;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax);
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax);
|
||||
|
||||
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
size_t scalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
if ( scalarSetIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
double globalMin = 0.0;
|
||||
double globalMax = 1.0;
|
||||
double localMin = 0.0;
|
||||
double localMax = 1.0;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax);
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax);
|
||||
|
||||
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
size_t scalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
|
||||
if ( scalarSetIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
double globalMin = 0.0;
|
||||
double globalMax = 1.0;
|
||||
double localMin = 0.0;
|
||||
double localMax = 1.0;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax);
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax);
|
||||
|
||||
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ public:
|
||||
void setReservoirView(RimEclipseView* ownerReservoirView);
|
||||
RimEclipseView* reservoirView();
|
||||
|
||||
void updateLegendData(size_t timestep);
|
||||
void updateLegendData(size_t timestep,
|
||||
RimLegendConfig* legendConfig = nullptr,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig = nullptr);
|
||||
RimLegendConfig* legendConfig();
|
||||
caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "Rim3dView.h"
|
||||
@@ -409,6 +410,8 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
|
||||
{
|
||||
viewLinker->updateCellResult();
|
||||
}
|
||||
RimGridView* eclView = dynamic_cast<RimGridView*>(view);
|
||||
if (eclView) eclView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
namespace caf {
|
||||
template<>
|
||||
@@ -691,6 +692,7 @@ void RimEclipseStatisticsCase::updateConnectedEditorsAndReservoirViews()
|
||||
// a full display model rebuild is required
|
||||
reservoirViews[i]->hasUserRequestedAnimation = true;
|
||||
reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
reservoirViews[i]->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -656,7 +656,9 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
|
||||
if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
|
||||
{
|
||||
m_crossSectionCollection->updateCellResultColor(m_currentTimeStep);
|
||||
m_crossSectionCollection->updateCellResultColor(m_currentTimeStep,
|
||||
this->cellResult()->legendConfig()->scalarMapper(),
|
||||
this->cellResult()->ternaryLegendConfig()->scalarMapper());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1035,7 +1037,7 @@ void RimEclipseView::updateLegends()
|
||||
}
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
|
||||
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName()));
|
||||
this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1060,71 +1062,24 @@ void RimEclipseView::updateLegends()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData)
|
||||
void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
|
||||
RimEclipseCellColors* resultColors,
|
||||
RigCaseCellResultsData* cellResultsData)
|
||||
{
|
||||
if (resultColors->hasResult())
|
||||
{
|
||||
resultColors->updateLegendData(m_currentTimeStep);
|
||||
|
||||
if (resultColors->hasResult())
|
||||
{
|
||||
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
|
||||
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiShortName()));
|
||||
resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiShortName());
|
||||
}
|
||||
|
||||
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
|
||||
if (resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1)
|
||||
{
|
||||
RigCaseCellResultsData* gridCellResults = resultColors->currentGridCellResults();
|
||||
{
|
||||
size_t scalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
if (scalarSetIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
double globalMin = 0.0;
|
||||
double globalMax = 1.0;
|
||||
double localMin = 0.0;
|
||||
double localMax = 1.0;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax);
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, m_currentTimeStep, localMin, localMax);
|
||||
|
||||
resultColors->ternaryLegendConfig()->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
size_t scalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
if (scalarSetIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
double globalMin = 0.0;
|
||||
double globalMax = 1.0;
|
||||
double localMin = 0.0;
|
||||
double localMax = 1.0;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax);
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, m_currentTimeStep, localMin, localMax);
|
||||
|
||||
resultColors->ternaryLegendConfig()->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
size_t scalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
|
||||
if (scalarSetIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
double globalMin = 0.0;
|
||||
double globalMax = 1.0;
|
||||
double localMin = 0.0;
|
||||
double localMax = 1.0;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax);
|
||||
cellResultsData->minMaxCellScalarValues(scalarSetIndex, m_currentTimeStep, localMin, localMax);
|
||||
|
||||
resultColors->ternaryLegendConfig()->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax);
|
||||
}
|
||||
}
|
||||
|
||||
if (resultColors->ternaryLegendConfig->legend())
|
||||
{
|
||||
resultColors->ternaryLegendConfig->legend()->setTitle(cvfqt::Utils::toString(legendLabel));
|
||||
resultColors->ternaryLegendConfig->setTitle(legendLabel);
|
||||
m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig->legend());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
@@ -499,6 +500,7 @@ void RimGeoMechCase::updateFormationNamesData()
|
||||
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
geomView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
@@ -214,7 +215,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
|
||||
// Get the possible property filter owner
|
||||
RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>(this->parentField()->ownerObject());
|
||||
Rim3dView* view = nullptr;
|
||||
RimGridView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType(view);
|
||||
RimPlotCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
@@ -261,7 +262,11 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
if (view) view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
}
|
||||
|
||||
if (view) view->scheduleCreateDisplayModelAndRedraw();
|
||||
if ( view )
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
view->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimGeoMechCellColors*>(this))
|
||||
{
|
||||
|
||||
@@ -290,7 +290,9 @@ void RimGeoMechView::updateCurrentTimeStep()
|
||||
|
||||
if (this->cellResult()->hasResult())
|
||||
{
|
||||
m_crossSectionCollection->updateCellResultColor(m_currentTimeStep);
|
||||
m_crossSectionCollection->updateCellResultColor(m_currentTimeStep,
|
||||
this->cellResult()->legendConfig()->scalarMapper(),
|
||||
nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -344,12 +346,22 @@ void RimGeoMechView::resetLegendsInViewer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::updateLegends()
|
||||
{
|
||||
if (m_viewer)
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removeAllColorLegends();
|
||||
}
|
||||
|
||||
if (!m_geomechCase || !m_viewer || !m_geomechCase->geoMechData()
|
||||
this->updateLegendTextAndRanges(cellResult()->legendConfig(), m_currentTimeStep());
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::updateLegendTextAndRanges(RimLegendConfig* legendConfig, int timeStepIndex)
|
||||
{
|
||||
if (!m_geomechCase || !m_geomechCase->geoMechData()
|
||||
|| !this->isTimeStepDependentDataVisible()
|
||||
|| !(cellResult()->resultAddress().isValid()) )
|
||||
{
|
||||
@@ -366,15 +378,15 @@ void RimGeoMechView::updateLegends()
|
||||
|
||||
RigFemResultAddress resVarAddress = cellResult()->resultAddress();
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValues(resVarAddress, m_currentTimeStep, &localMin, &localMax);
|
||||
gmCase->femPartResults()->posNegClosestToZero(resVarAddress, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
||||
gmCase->femPartResults()->minMaxScalarValues(resVarAddress, timeStepIndex, &localMin, &localMax);
|
||||
gmCase->femPartResults()->posNegClosestToZero(resVarAddress, timeStepIndex, &localPosClosestToZero, &localNegClosestToZero);
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValues(resVarAddress, &globalMin, &globalMax);
|
||||
gmCase->femPartResults()->posNegClosestToZero(resVarAddress, &globalPosClosestToZero, &globalNegClosestToZero);
|
||||
|
||||
|
||||
cellResult()->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
cellResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (cellResult()->hasCategoryResult())
|
||||
{
|
||||
@@ -383,18 +395,16 @@ void RimGeoMechView::updateLegends()
|
||||
{
|
||||
fnVector = gmCase->femPartResults()->activeFormationNames()->formationNames();
|
||||
}
|
||||
cellResult()->legendConfig->setNamedCategoriesInverse(fnVector);
|
||||
legendConfig->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
|
||||
|
||||
cvf::String legendTitle = cvfqt::Utils::toString(
|
||||
QString legendTitle =
|
||||
caf::AppEnum<RigFemResultPosEnum>(cellResult->resultPositionType()).uiText() + "\n"
|
||||
+ cellResult->resultFieldUiName());
|
||||
+ cellResult->resultFieldUiName();
|
||||
|
||||
if (!cellResult->resultComponentUiName().isEmpty())
|
||||
{
|
||||
legendTitle += ", " + cvfqt::Utils::toString(cellResult->resultComponentUiName());
|
||||
legendTitle += ", " + cellResult->resultComponentUiName();
|
||||
}
|
||||
|
||||
if ( cellResult->resultFieldName() == "SE" || cellResult->resultFieldName() == "ST" || cellResult->resultFieldName() == "POR-Bar"
|
||||
@@ -408,7 +418,7 @@ void RimGeoMechView::updateLegends()
|
||||
legendTitle += " [GPa]";
|
||||
}
|
||||
|
||||
cellResult()->legendConfig->setTitle(legendTitle);
|
||||
legendConfig->setTitle(legendTitle);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,7 @@ class RimGeoMechPropertyFilterCollection;
|
||||
class RiuViewer;
|
||||
class RivGeoMechPartMgr;
|
||||
class RivGeoMechVizLogic;
|
||||
class RimLegendConfig;
|
||||
|
||||
namespace cvf {
|
||||
class CellRangeFilter;
|
||||
@@ -84,6 +85,8 @@ public:
|
||||
|
||||
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) override;
|
||||
|
||||
void updateLegendTextAndRanges(RimLegendConfig* legendConfig, int timeStepIndex);
|
||||
|
||||
protected:
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimIntersection.h"
|
||||
@@ -95,7 +96,9 @@ void RimIntersectionCollection::applySingleColorEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
void RimIntersectionCollection::updateCellResultColor(size_t timeStepIndex,
|
||||
const cvf::ScalarMapper* scalarColorMapper,
|
||||
const RivTernaryScalarMapper* ternaryColorMapper)
|
||||
{
|
||||
if(!this->isActive()) return;
|
||||
|
||||
@@ -103,7 +106,7 @@ void RimIntersectionCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if(cs->isActive)
|
||||
{
|
||||
cs->intersectionPartMgr()->updateCellResultColor(timeStepIndex);
|
||||
cs->intersectionPartMgr()->updateCellResultColor(timeStepIndex, scalarColorMapper, ternaryColorMapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +189,17 @@ void RimIntersectionCollection::syncronize2dIntersectionViews()
|
||||
ownerCase->intersectionViewCollection()->syncFromExistingIntersections(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionCollection::scheduleCreateDisplayModelAndRedraw2dIntersectionViews()
|
||||
{
|
||||
for (RimIntersection* isection: m_intersections)
|
||||
{
|
||||
isection->correspondingIntersectionView()->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -27,10 +27,12 @@ class RimIntersection;
|
||||
class RimIntersectionBox;
|
||||
class RimEclipseCellColors;
|
||||
class RimSimWellInView;
|
||||
class RivTernaryScalarMapper;
|
||||
|
||||
namespace cvf {
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class ScalarMapper;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -59,11 +61,14 @@ public:
|
||||
void updateIntersectionBoxGeometry();
|
||||
|
||||
void syncronize2dIntersectionViews();
|
||||
void scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
|
||||
// Visualization interface
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
void updateCellResultColor(size_t timeStepIndex,
|
||||
const cvf::ScalarMapper* scalarColorMapper,
|
||||
const RivTernaryScalarMapper* ternaryColorMapper);
|
||||
void appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
|
||||
@@ -191,7 +192,7 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
|
||||
updateLegend();
|
||||
|
||||
Rim3dView* view = nullptr;
|
||||
RimGridView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType(view);
|
||||
|
||||
if (view)
|
||||
@@ -203,6 +204,8 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
|
||||
view->updateCurrentTimeStepAndRedraw();
|
||||
|
||||
view->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
@@ -664,10 +667,11 @@ QString RimLegendConfig::categoryNameFromCategoryValue(double categoryResultValu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimLegendConfig::setTitle(const cvf::String& title)
|
||||
void RimLegendConfig::setTitle(const QString& title)
|
||||
{
|
||||
m_scalarMapperLegend->setTitle(title);
|
||||
m_categoryLegend->setTitle(title);
|
||||
auto cvfTitle = cvfqt::Utils::toString(title);
|
||||
m_scalarMapperLegend->setTitle(cvfTitle);
|
||||
m_categoryLegend->setTitle(cvfTitle);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -692,6 +696,7 @@ void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLe
|
||||
{
|
||||
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
|
||||
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
|
||||
this->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -114,7 +114,9 @@ public:
|
||||
void setCategoryItems(const std::vector<std::tuple<QString, int, cvf::Color3ub>>& categories);
|
||||
QString categoryNameFromCategoryValue(double categoryResultValue) const;
|
||||
|
||||
void setTitle(const cvf::String& title);
|
||||
void setTitle(const QString& title);
|
||||
|
||||
void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig);
|
||||
|
||||
cvf::ScalarMapper* scalarMapper() { return m_currentScalarMapper.p(); }
|
||||
cvf::OverlayItem* legend();
|
||||
@@ -134,7 +136,6 @@ private:
|
||||
double roundToNumSignificantDigits(double value, double precision);
|
||||
|
||||
friend class RimViewLinker;
|
||||
void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig);
|
||||
|
||||
static cvf::Color3ubArray colorArrayFromColorType(ColorRangesType colorType);
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ void RimStimPlanColors::updateLegendData()
|
||||
legendConfig->setClosestToZeroValues(posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero);
|
||||
}
|
||||
|
||||
legendConfig->setTitle(cvfqt::Utils::toString(m_resultNameAndUnit()));
|
||||
legendConfig->setTitle(m_resultNameAndUnit());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "RivTernarySaturationOverlayItem.h"
|
||||
@@ -146,7 +147,7 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
updateLabelText();
|
||||
updateLegend();
|
||||
|
||||
Rim3dView* view = nullptr;
|
||||
RimGridView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType(view);
|
||||
|
||||
if (view)
|
||||
@@ -158,6 +159,7 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
}
|
||||
|
||||
view->updateCurrentTimeStepAndRedraw();
|
||||
view->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +246,7 @@ void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendC
|
||||
{
|
||||
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
|
||||
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
|
||||
this->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -316,6 +319,14 @@ void RimTernaryLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RivTernarySaturationOverlayItem* RimTernaryLegendConfig::legend() const
|
||||
{
|
||||
return m_legend.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -324,6 +335,14 @@ RivTernarySaturationOverlayItem* RimTernaryLegendConfig::legend()
|
||||
return m_legend.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTernaryLegendConfig::setTitle(const QString& title)
|
||||
{
|
||||
m_legend->setTitle(cvfqt::Utils::toString(title));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -462,7 +481,7 @@ void RimTernaryLegendConfig::updateLabelText()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper()
|
||||
const RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper() const
|
||||
{
|
||||
return m_scalarMapper.p();
|
||||
}
|
||||
|
||||
@@ -65,13 +65,17 @@ public:
|
||||
RimTernaryLegendConfig();
|
||||
virtual ~RimTernaryLegendConfig();
|
||||
|
||||
void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig);
|
||||
void setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax);
|
||||
void ternaryRanges(double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper) const;
|
||||
|
||||
void recreateLegend();
|
||||
|
||||
const RivTernarySaturationOverlayItem* legend() const;
|
||||
RivTernarySaturationOverlayItem* legend();
|
||||
RivTernaryScalarMapper* scalarMapper();
|
||||
void setTitle(const QString& title);
|
||||
|
||||
const RivTernaryScalarMapper* scalarMapper() const;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
@@ -83,9 +87,6 @@ private:
|
||||
void updateLabelText();
|
||||
double roundToNumSignificantDigits(double value, double precision);
|
||||
|
||||
friend class RimViewLinker;
|
||||
void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig);
|
||||
|
||||
private:
|
||||
caf::PdmField<int> precision;
|
||||
caf::PdmField<RangeModeEnum> rangeMode;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimViewController, "ViewController");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -688,6 +689,11 @@ void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView() co
|
||||
this->managedView()->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->isResultColorControlled() && this->managedView() )
|
||||
{
|
||||
this->managedView()->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
@@ -152,10 +153,10 @@ void RimViewLinker::updateCellResult()
|
||||
eclipseView->cellResult()->legendConfig()->updateLegend();
|
||||
|
||||
eclipseView->cellResult()->ternaryLegendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->ternaryLegendConfig());
|
||||
eclipseView->cellResult()->ternaryLegendConfig()->updateLegend();
|
||||
}
|
||||
|
||||
eclipseView->scheduleCreateDisplayModelAndRedraw();
|
||||
eclipseView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
|
||||
eclipseView->cellResult()->updateIconState();
|
||||
@@ -190,6 +191,7 @@ void RimViewLinker::updateCellResult()
|
||||
}
|
||||
|
||||
geoView->scheduleCreateDisplayModelAndRedraw();
|
||||
geoView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
|
||||
geoView->cellResult()->updateIconState();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
|
||||
@@ -550,6 +551,7 @@ public:
|
||||
// It is usually not needed to create new display model, but if any derived geometry based on generated data (from Octave)
|
||||
// a full display model rebuild is required
|
||||
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_currentReservoir->reservoirViews[i]->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "RimEclipseInputProperty.h"
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@@ -690,6 +691,7 @@ public:
|
||||
// It is usually not needed to create new display model, but if any derived geometry based on generated data (from Octave)
|
||||
// a full display model rebuild is required
|
||||
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_currentReservoir->reservoirViews[i]->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1053,6 +1055,8 @@ public:
|
||||
// It is usually not needed to create new display model, but if any derived geometry based on generated data (from Octave)
|
||||
// a full display model rebuild is required
|
||||
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_currentReservoir->reservoirViews[i]->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user