Merge with Flow Gui additions

This commit is contained in:
Jacob Støren
2016-12-14 11:14:21 +01:00
38 changed files with 531 additions and 237 deletions

View File

@@ -90,7 +90,6 @@ RimCellEdgeColors::~RimCellEdgeColors()
void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView)
{
m_reservoirView = ownerReservoirView;
this->m_legendConfig()->setReservoirView(ownerReservoirView);
m_singleVarEdgeResultColors->setReservoirView(ownerReservoirView);
}

View File

@@ -135,7 +135,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
if (!found)
{
RimLegendConfig* newLegend = new RimLegendConfig;
newLegend->setReservoirView(m_reservoirView);
newLegend->resultVariableName = resultVarNameOfNewLegend;
m_legendConfigData.push_back(newLegend);
@@ -225,13 +224,6 @@ void RimEclipseCellColors::setReservoirView(RimEclipseView* ownerReservoirView)
this->setEclipseCase(ownerReservoirView->eclipseCase());
m_reservoirView = ownerReservoirView;
for (size_t i = 0; i < m_legendConfigData.size(); i++)
{
m_legendConfigData[i]->setReservoirView(ownerReservoirView);
}
this->ternaryLegendConfig()->setReservoirView(ownerReservoirView);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -124,7 +124,6 @@ RimEclipseView::RimEclipseView()
this->cellResult()->setReservoirView(this);
this->cellEdgeResult()->setReservoirView(this);
this->cellEdgeResult()->legendConfig()->setReservoirView(this);
this->cellEdgeResult()->legendConfig()->setColorRangeMode(RimLegendConfig::PINK_WHITE);
this->faultResultSettings()->setReservoirView(this);
@@ -132,7 +131,6 @@ RimEclipseView::RimEclipseView()
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this);
m_reservoir = NULL;
}
@@ -270,8 +268,6 @@ void RimEclipseView::updateScaleTransform()
this->scaleTransform()->setLocalTransform(scale);
m_pipesPartManager->setScaleTransform(this->scaleTransform());
m_wellSpheresPartManager->setScaleTransform(this->scaleTransform());
if (m_viewer) m_viewer->updateCachedValuesInScene();
}
@@ -500,7 +496,6 @@ void RimEclipseView::createDisplayModel()
if (frameModels.size() > 1 && this->hasUserRequestedAnimation())
{
m_viewer->animationControl()->setCurrentFrameOnly(m_currentTimeStep);
m_viewer->setCurrentFrame(m_currentTimeStep);
}
else
@@ -669,7 +664,6 @@ void RimEclipseView::updateCurrentTimeStep()
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
wellPipeModelBasicList->updateBoundingBoxesRecursive();
this->removeModelByName(frameScene, wellPipeModelBasicList->name());
@@ -902,6 +896,7 @@ void RimEclipseView::scheduleReservoirGridGeometryRegen()
void RimEclipseView::schedulePipeGeometryRegen()
{
m_pipesPartManager->scheduleGeometryRegen();
m_wellSpheresPartManager->clearGeometryCache();
}
@@ -1310,6 +1305,7 @@ void RimEclipseView::updateDisplayModelForWellResults()
{
m_reservoirGridPartManager->clearGeometryCache();
m_pipesPartManager->clearGeometryCache();
m_wellSpheresPartManager->clearGeometryCache();
syncronizeWellsWithResults();

View File

@@ -42,6 +42,7 @@ RimEclipseWell::RimEclipseWell()
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", "");
CAF_PDM_InitField(&showWellPipes, "ShowWellPipe", true, "Show well pipe", "", "", "");
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show well spheres", "", "", "");
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale",1.0, "Pipe radius scale", "", "", "");
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", "");
@@ -121,6 +122,10 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&showWellSpheres == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&wellPipeColor == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
@@ -146,7 +151,80 @@ caf::PdmFieldHandle* RimEclipseWell::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
{
if (this->wellResults() == nullptr) return false;
if (!wellResults()->hasWellResult(frameIndex)) return false;
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx)
{
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
// First check the wellhead:
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex;
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
{
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
if ((*cellVisibility)[gridCellIndex])
{
return true;
}
}
// Then check the rest of the well, with all the branches
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
{
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx)
{
if (wsResCells[cIdx].isCell())
{
gridIndex = wsResCells[cIdx].m_gridIndex;
gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
if ((*cellVisibility)[gridCellIndex])
{
return true;
}
}
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance");
pipeGroup->add(&showWellPipes);
pipeGroup->add(&showWellSpheres);
pipeGroup->add(&showWellLabel);
pipeGroup->add(&wellPipeColor);
pipeGroup->add(&pipeRadiusScaleFactor);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
filterGroup->add(&showWellCells);
filterGroup->add(&showWellCellFence);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
{
if (m_reservoirView == NULL) return false;
if (this->wellResults() == NULL) return false;
@@ -171,10 +249,10 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF)
return false;
if ( this->showWell() == false )
if (this->showWell() == false)
return false;
if ( this->showWellPipes() == false )
if (this->showWellPipes() == false)
return false;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY)
@@ -185,51 +263,7 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
{
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx)
{
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
// First check the wellhead:
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex;
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
{
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
if ((*cellVisibility)[gridCellIndex])
{
return true;
}
}
// Then check the rest of the well, with all the branches
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
{
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx)
{
if (wsResCells[cIdx].isCell())
{
gridIndex = wsResCells[cIdx].m_gridIndex;
gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
if ((*cellVisibility)[gridCellIndex])
{
return true;
}
}
}
}
}
return false;
return visibleCellsInstersectsWell(frameIndex);
}
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
@@ -240,28 +274,51 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
{
caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance");
pipeGroup->add(&showWellPipes);
pipeGroup->add(&showWellLabel);
pipeGroup->add(&wellPipeColor);
pipeGroup->add(&pipeRadiusScaleFactor);
if (m_reservoirView == NULL) return false;
if (this->wellResults() == NULL) return false;
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
filterGroup->add(&showWellCells);
filterGroup->add(&showWellCellFence);
}
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
{
CVF_ASSERT(m_resultWellIndex != cvf::UNDEFINED_SIZE_T);
size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex];
if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T)
{
return false;
}
// Return the possibly cached value
return m_reservoirView->wellCollection()->resultWellPipeVisibilities(frameIndex)[m_resultWellIndex];
if (!m_reservoirView->wellCollection()->isActive())
return false;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON)
return true;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF)
return false;
if (this->showWell() == false)
return false;
if (this->showWellSpheres() == false)
return false;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY)
return true;
if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
return true;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
{
return visibleCellsInstersectsWell(frameIndex);
}
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
return false;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -53,8 +53,9 @@ public:
size_t resultWellIndex() { return m_resultWellIndex; }
bool isWellPipeVisible(size_t frameIndex);
bool isWellSpheresVisible(size_t frameIndex);
bool calculateWellPipeVisibility(size_t frameIndex);
bool visibleCellsInstersectsWell(size_t frameIndex);
virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField();
@@ -71,6 +72,7 @@ public:
caf::PdmField<bool> showWellCellFence;
caf::PdmField<bool> showWellPipes;
caf::PdmField<bool> showWellSpheres;
caf::PdmField<cvf::Color3f> wellPipeColor;
caf::PdmField<double> pipeRadiusScaleFactor;

View File

@@ -108,7 +108,7 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Geometry based branch detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", "");
CAF_PDM_InitField(&showCellCenterSpheres, "showCellCenterSpheres", false, "Show sphere in cell center", "", "", "");
CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_FORCE_ALL_OFF), "Global well sphere visibility", "", "", "");
CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", "");
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", "");
@@ -178,17 +178,17 @@ bool RimEclipseWellCollection::hasVisibleWellCells()
//--------------------------------------------------------------------------------------------------
/// Used to know if we need animation of timesteps due to the wells
//--------------------------------------------------------------------------------------------------
bool RimEclipseWellCollection::hasVisibleWellPipes()
bool RimEclipseWellCollection::hasVisibleWellPipes()
{
if (!this->isActive()) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF && this->wellSphereVisibility() == PIPES_FORCE_ALL_OFF ) return false;
if (this->wells().size() == 0 ) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true;
if (this->wellSphereVisibility() == PIPES_FORCE_ALL_ON) return true;
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -227,7 +227,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if ( &showCellCenterSpheres == changedField
else if ( &wellSphereVisibility == changedField
|| &cellCenterSpheresScaleFactor == changedField)
{
if (m_reservoirView)
@@ -296,9 +296,8 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
wellPipe->add(&wellPipeVisibility);
wellPipe->add(&pipeRadiusScaleFactor);
//TODO: Add Well sphere group
caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres");
cellCenterSpheres->add(&showCellCenterSpheres);
cellCenterSpheres->add(&wellSphereVisibility);
cellCenterSpheres->add(&cellCenterSpheresScaleFactor);
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
@@ -318,9 +317,9 @@ caf::PdmFieldHandle* RimEclipseWellCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::ubyte>& RimEclipseWellCollection::resultWellPipeVisibilities(size_t frameIndex)
const std::vector<cvf::ubyte>& RimEclipseWellCollection::resultWellGeometryVisibilities(size_t frameIndex)
{
calculateIsWellPipesVisible(frameIndex);
calculateWellGeometryVisibility(frameIndex);
return m_framesOfResultWellPipeVisibilities[frameIndex];
}
@@ -335,7 +334,7 @@ void RimEclipseWellCollection::scheduleIsWellPipesVisibleRecalculation()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWellCollection::calculateIsWellPipesVisible(size_t frameIndex)
void RimEclipseWellCollection::calculateWellGeometryVisibility(size_t frameIndex)
{
if (m_framesOfResultWellPipeVisibilities.size() > frameIndex && m_framesOfResultWellPipeVisibilities[frameIndex].size()) return;
@@ -347,7 +346,10 @@ void RimEclipseWellCollection::calculateIsWellPipesVisible(size_t frameIndex)
for (size_t i = 0; i < wells().size(); ++i)
{
m_framesOfResultWellPipeVisibilities[frameIndex][wells[i]->resultWellIndex()] = wells[i]->calculateWellPipeVisibility(frameIndex);
bool wellPipeVisible = wells[i]->isWellPipeVisible(frameIndex);
bool wellSphereVisible = wells[i]->isWellSpheresVisible(frameIndex);
m_framesOfResultWellPipeVisibilities[frameIndex][wells[i]->resultWellIndex()] = wellPipeVisible || wellSphereVisible;
}
}

View File

@@ -45,7 +45,7 @@ public:
RimEclipseWellCollection();
virtual ~RimEclipseWellCollection();
void setReservoirView(RimEclipseView* ownerReservoirView);
enum WellVisibilityType
@@ -102,7 +102,7 @@ public:
caf::PdmField<bool> isAutoDetectingBranches;
caf::PdmField<bool> showCellCenterSpheres;
caf::PdmField<WellVisibilityEnum> wellSphereVisibility;
caf::PdmField<double> cellCenterSpheresScaleFactor;
@@ -113,7 +113,7 @@ public:
bool hasVisibleWellPipes();
void sortWellsByName();
const std::vector<cvf::ubyte>& resultWellPipeVisibilities(size_t frameIndex);
const std::vector<cvf::ubyte>& resultWellGeometryVisibilities(size_t frameIndex);
void scheduleIsWellPipesVisibleRecalculation();
protected:
@@ -122,7 +122,7 @@ protected:
virtual caf::PdmFieldHandle* objectToggleField();
private:
void calculateIsWellPipesVisible(size_t frameIndex);
void calculateWellGeometryVisibility(size_t frameIndex);
RimEclipseView* m_reservoirView;
std::vector< std::vector< cvf::ubyte > >

View File

@@ -84,9 +84,6 @@ RimGeoMechView::RimGeoMechView(void)
m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection();
m_propertyFilterCollection.uiCapability()->setUiHidden(true);
//this->cellResult()->setReservoirView(this);
this->cellResult()->legendConfig()->setReservoirView(this);
m_scaleTransform = new cvf::Transform();
m_vizLogic = new RivGeoMechVizLogic(this);
}
@@ -257,7 +254,6 @@ void RimGeoMechView::createDisplayModel()
if (isTimeStepDependentDataVisible())
{
m_viewer->animationControl()->setCurrentFrameOnly(m_currentTimeStep);
m_viewer->setCurrentFrame(m_currentTimeStep);
}
else

View File

@@ -26,6 +26,7 @@
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimGeoMechResultDefinition.h"
#include "RimViewLinker.h"
#include "cafCategoryLegend.h"
#include "cafCategoryMapper.h"
@@ -182,7 +183,19 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
updateLegend();
if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw();
RimView* view = nullptr;
this->firstAncestorOrThisOfType(view);
if (view)
{
RimViewLinker* viewLinker = view->assosiatedViewLinker();
if (viewLinker)
{
viewLinker->updateCellResult();
}
view->updateCurrentTimeStepAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
@@ -758,6 +771,15 @@ cvf::OverlayItem* RimLegendConfig::legend()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig)
{
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -57,8 +57,6 @@ public:
RimLegendConfig();
virtual ~RimLegendConfig();
void setReservoirView(RimView* ownerReservoirView) {m_reservoirView = ownerReservoirView; }
caf::PdmField<QString> resultVariableName; // Used internally to describe the variable this legend setup is used for
enum RangeModeType
@@ -126,10 +124,10 @@ private:
cvf::ref<cvf::Color3ubArray> interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount);
double roundToNumSignificantDigits(double value, double precision);
friend class RimViewLinker;
void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig);
private:
caf::PdmPointer<RimView> m_reservoirView;
cvf::ref<cvf::ScalarMapperDiscreteLinear> m_linDiscreteScalarMapper;
cvf::ref<cvf::ScalarMapperDiscreteLog> m_logDiscreteScalarMapper;
cvf::ref<cvf::ScalarMapperContinuousLog> m_logSmoothScalarMapper;

View File

@@ -25,6 +25,18 @@
#include "cafPdmPointer.h"
namespace caf
{
template<>
void caf::AppEnum< RimMultiSnapshotDefinition::SnapShotDirectionEnum >::setUp()
{
addItem(RimMultiSnapshotDefinition::RANGEFILTER_I, "I", "i-direction");
addItem(RimMultiSnapshotDefinition::RANGEFILTER_J, "J", "j-direction");
addItem(RimMultiSnapshotDefinition::RANGEFILTER_K, "K", "k-direction");
setDefault(RimMultiSnapshotDefinition::RANGEFILTER_K);
}
}
CAF_PDM_SOURCE_INIT(RimMultiSnapshotDefinition, "MultiSnapshotDefinition");
@@ -40,6 +52,12 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(RANGEFILTER_K), "Range Filter direction", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 0, "RangeFilter Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 0, "RangeFilter End", "", "", "");
}
@@ -69,7 +87,7 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(c))));
}
options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
//options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
}
else if (fieldNeedingOptions == &viewObject)
{
@@ -82,9 +100,34 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
}
}
options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
//options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
}
else if (fieldNeedingOptions == &timeStepEnd)
{
getTimeStepStrings(options);
}
else if (fieldNeedingOptions == &timeStepStart)
{
getTimeStepStrings(options);
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiSnapshotDefinition::getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options)
{
if (!caseObject()) return;
QStringList timeSteps = caseObject()->timeStepStrings();
for (int i = 0; i < timeSteps.size(); i++)
{
options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i));
}
}

View File

@@ -21,6 +21,7 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafAppEnum.h"
class RimCase;
class RimView;
@@ -42,6 +43,20 @@ public:
caf::PdmField<int> timeStepStart;
caf::PdmField<int> timeStepEnd;
enum SnapShotDirectionEnum
{
RANGEFILTER_I,
RANGEFILTER_J,
RANGEFILTER_K
};
caf::PdmField< caf::AppEnum< SnapShotDirectionEnum > > sliceDirection;
caf::PdmField<int> startSliceIndex;
caf::PdmField<int> endSliceIndex;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
void getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options);
};

View File

@@ -19,15 +19,17 @@
#include "RimTernaryLegendConfig.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTextEditor.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimViewLinker.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivTernaryScalarMapper.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTextEditor.h"
#include "cvfqtUtils.h"
#include <cmath>
@@ -152,7 +154,19 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
updateLabelText();
updateLegend();
if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw();
RimView* view = nullptr;
this->firstAncestorOrThisOfType(view);
if (view)
{
RimViewLinker* viewLinker = view->assosiatedViewLinker();
if (viewLinker)
{
viewLinker->updateCellResult();
}
view->updateCurrentTimeStepAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
@@ -231,6 +245,15 @@ void RimTernaryLegendConfig::recreateLegend()
updateLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig)
{
QString serializedObjectString = otherLegendConfig->writeObjectToXmlString();
this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance());
}
//--------------------------------------------------------------------------------------------------
/// Rounding the double value to given number of significant digits
//--------------------------------------------------------------------------------------------------

View File

@@ -65,15 +65,13 @@ public:
RimTernaryLegendConfig();
virtual ~RimTernaryLegendConfig();
void setReservoirView(RimEclipseView* ownerReservoirView) {m_reservoirView = ownerReservoirView; }
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();
RivTernarySaturationOverlayItem* legend();
RivTernaryScalarMapper* scalarMapper();
RivTernaryScalarMapper* scalarMapper();
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
@@ -84,7 +82,9 @@ private:
void updateLegend();
void updateLabelText();
double roundToNumSignificantDigits(double value, double precision);
friend class RimViewLinker;
void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig);
private:
caf::PdmField<int> precision;
@@ -107,7 +107,6 @@ private:
std::vector<double> m_localAutoMax;
std::vector<double> m_localAutoMin;
caf::PdmPointer<RimEclipseView> m_reservoirView;
cvf::ref<RivTernarySaturationOverlayItem> m_legend;
cvf::ref<RivTernaryScalarMapper> m_scalarMapper;
};

View File

@@ -137,10 +137,8 @@ public:
void setScaleZAndUpdate(double scaleZ);
// Animation
int currentTimeStep() { return m_currentTimeStep;}
void setCurrentTimeStep(int frameIdx);
int currentTimeStep() const { return m_currentTimeStep;}
void updateCurrentTimeStepAndRedraw();
void endAnimation();
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType) = 0;
void scheduleCreateDisplayModelAndRedraw();
@@ -230,6 +228,11 @@ protected:
private:
RimViewLinker* viewLinkerIfMasterView() const;
friend class RiuViewer;
void setCurrentTimeStep(int frameIdx);
void endAnimation();
private:
bool m_previousGridModeMeshLinesWasFaults;
caf::PdmField<bool> m_disableLighting;

View File

@@ -66,9 +66,10 @@ RimViewController::RimViewController(void)
CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", "");
m_managedView.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", "");
CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Color Result", "", "", "");
CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", "");
CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", "");
CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Legend Definition", "", "", "");
CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", "");
/// We do not support this. Consider to remove sometime
@@ -185,6 +186,10 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
managedGeoView()->cellResult()->updateIconState();
}
}
else if (changedField == &m_syncLegendDefinitions)
{
updateLegendDefinitions();
}
else if (changedField == &m_syncRangeFilters)
{
if (!m_syncRangeFilters)
@@ -365,6 +370,7 @@ void RimViewController::updateOptionSensitivity()
{
isMasterAndDependentViewDifferentType = true;
}
if (geoMasterView && !managedGeoView())
{
isMasterAndDependentViewDifferentType = true;
@@ -374,10 +380,22 @@ void RimViewController::updateOptionSensitivity()
{
this->m_syncCellResult.uiCapability()->setUiReadOnly(true);
this->m_syncCellResult = false;
this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true);
this->m_syncLegendDefinitions = false;
}
else
{
this->m_syncCellResult.uiCapability()->setUiReadOnly(false);
if (this->m_syncCellResult)
{
this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(false);
}
else
{
this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true);
}
}
if (isPropertyFilterControlPossible())
@@ -390,7 +408,6 @@ void RimViewController::updateOptionSensitivity()
this->m_syncPropertyFilters = false;
}
if (isRangeFilterControlPossible())
{
this->m_syncRangeFilters.uiCapability()->setUiReadOnly(false);
@@ -440,6 +457,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
scriptGroup->add(&m_syncCamera);
scriptGroup->add(&m_syncTimeStep);
scriptGroup->add(&m_syncCellResult);
scriptGroup->add(&m_syncLegendDefinitions);
caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup("Link Cell Filters");
visibleCells->add(&m_syncVisibleCells);
@@ -498,6 +516,17 @@ void RimViewController::updateResultColorsControl()
viewLinker->updateCellResult();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewController::updateLegendDefinitions()
{
if (!this->isLegendDefinitionsControlled()) return;
RimViewLinker* viewLinker = ownerViewLinker();
viewLinker->updateCellResult();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -714,6 +743,21 @@ bool RimViewController::isResultColorControlled()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isLegendDefinitionsControlled()
{
if (ownerViewLinker()->isActive() && this->m_isActive())
{
return m_syncLegendDefinitions;
}
else
{
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -61,6 +61,7 @@ public:
bool isTimeStepLinked();
bool isResultColorControlled();
bool isLegendDefinitionsControlled();
bool isRangeFiltersControlled();
bool isVisibleCellsOveridden();
@@ -90,6 +91,7 @@ private:
void updateCameraLink();
void updateTimeStepLink();
void updateResultColorsControl();
void updateLegendDefinitions();
bool isMasterAndDepViewDifferentType();
bool isRangeFilterControlPossible();
@@ -111,6 +113,7 @@ private:
// Overridden properties
caf::PdmField<bool> m_syncCellResult;
caf::PdmField<bool> m_syncLegendDefinitions;
caf::PdmField<bool> m_syncRangeFilters;
caf::PdmField<bool> m_syncVisibleCells;

View File

@@ -24,7 +24,6 @@
#include "RigCaseData.h"
#include "RimCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseInputCase.h"
#include "RimEclipseResultCase.h"
@@ -34,16 +33,17 @@
#include "RimGeoMechCellColors.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimViewController.h"
#include "RimLegendConfig.h"
#include "RimProject.h"
#include "RimTernaryLegendConfig.h"
#include "RimView.h"
#include "RimViewController.h"
#include "RimViewLinkerCollection.h"
#include "RiuViewer.h"
#include "cvfCamera.h"
#include "cvfScene.h"
#include "cafFrameAnimationControl.h"
#include "cvfMatrix4.h"
#include "cafPdmUiTreeOrdering.h"
@@ -102,7 +102,6 @@ void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep)
if (m_masterView && m_masterView->viewer() && sourceView != m_masterView)
{
m_masterView->viewer()->setCurrentFrame(timeStep);
m_masterView->viewer()->animationControl()->setCurrentFrameOnly(timeStep);
}
for (size_t i = 0; i < m_viewControllers.size(); i++)
@@ -116,7 +115,6 @@ void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep)
&& viewLink->managedView()->viewer())
{
viewLink->managedView()->viewer()->setCurrentFrame(timeStep);
viewLink->managedView()->viewer()->animationControl()->setCurrentFrameOnly(timeStep);
}
}
}
@@ -147,6 +145,16 @@ void RimViewLinker::updateCellResult()
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable());
if (viewLink->isLegendDefinitionsControlled())
{
eclipeView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->legendConfig());
eclipeView->cellResult()->legendConfig()->updateLegend();
eclipeView->cellResult()->ternaryLegendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->ternaryLegendConfig());
eclipeView->cellResult()->ternaryLegendConfig()->updateLegend();
}
eclipeView->scheduleCreateDisplayModelAndRedraw();
}
@@ -174,6 +182,13 @@ void RimViewLinker::updateCellResult()
if (viewLink->isResultColorControlled())
{
geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress());
if (viewLink->isLegendDefinitionsControlled())
{
geoView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterGeoView->cellResult()->legendConfig());
geoView->cellResult()->legendConfig()->updateLegend();
}
geoView->scheduleCreateDisplayModelAndRedraw();
}

View File

@@ -66,6 +66,7 @@ public:
void updateScaleZ(RimView* sourceView, double scaleZ);
void updateCellResult();
void updateRangeFilters(RimCellRangeFilter* changedRangeFilter);
void applyRangeFilterCollectionByUserChoice();