Linked Views: created access methods for viewController settings

The access methods now respects the active settings on both the ViewController
and the Toplevel.
This commit is contained in:
Jacob Støren 2015-09-25 09:39:42 +02:00
parent 8c63f4963b
commit c79a01f3b9
10 changed files with 181 additions and 98 deletions

View File

@ -140,7 +140,7 @@ void RivGeoMechVizLogic::scheduleRegenOfDirectlyDependentGeometry(RivCellSetEnum
std::vector<RivGeoMechPartMgrCache::Key> RivGeoMechVizLogic::keysToVisiblePartMgrs(int timeStepIndex)
{
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs;
if (m_geomechView->controllingViewLink() && m_geomechView->controllingViewLink()->syncVisibleCells())
if (m_geomechView->controllingViewLink() && m_geomechView->controllingViewLink()->isVisibleCellsOveridden())
{
visiblePartMgrs.push_back(RivGeoMechPartMgrCache::Key(OVERRIDDEN_CELL_VISIBILITY, -1));
}

View File

@ -321,7 +321,7 @@ void RimCellRangeFilterCollection::updateIconState()
bool activeIcon = true;
RimViewController* viewLink = RimViewLinker::viewLinkForView(baseView());
if (viewLink && viewLink->syncRangeFilters())
if (viewLink && viewLink->isRangeFilterOveridden())
{
activeIcon = false;
}

View File

@ -230,7 +230,7 @@ RimLegendConfig* RimEclipseCellColors::legendConfig()
void RimEclipseCellColors::updateIconState()
{
RimViewController* viewLink = RimViewLinker::viewLinkForView(m_reservoirView);
if (viewLink && viewLink->syncCellResult())
if (viewLink && viewLink->isResultColorControlled())
{
updateUiIconFromState(false);
}

View File

@ -157,7 +157,7 @@ void RimEclipsePropertyFilterCollection::updateIconState()
RimEclipseView* view = NULL;
this->firstAnchestorOrThisOfType(view);
RimViewController* viewLink = RimViewLinker::viewLinkForView(view);
if (viewLink && viewLink->syncPropertyFilters())
if (viewLink && viewLink->isPropertyFilterOveridden())
{
activeIcon = false;
}

View File

@ -331,12 +331,12 @@ void RimEclipseView::createDisplayModel()
// For property filtered geometry : just set all the models as empty scenes
// updateCurrentTimeStep requests the actual parts
if (this->controllingViewLink() && this->controllingViewLink()->syncVisibleCells()
if (this->controllingViewLink() && this->controllingViewLink()->isVisibleCellsOveridden()
|| !this->propertyFilterCollection()->hasActiveFilters())
{
std::vector<RivCellSetEnum> geometryTypesToAdd;
if (this->controllingViewLink() && this->controllingViewLink()->syncVisibleCells())
if (this->controllingViewLink() && this->controllingViewLink()->isVisibleCellsOveridden())
{
geometryTypesToAdd.push_back(OVERRIDDEN_CELL_VISIBILITY);
@ -581,7 +581,7 @@ void RimEclipseView::updateCurrentTimeStep()
geometriesToRecolor.push_back(RANGE_FILTERED);
geometriesToRecolor.push_back(RANGE_FILTERED_WELL_CELLS);
}
else if (this->controllingViewLink() && this->controllingViewLink()->syncVisibleCells())
else if (this->controllingViewLink() && this->controllingViewLink()->isVisibleCellsOveridden())
{
geometriesToRecolor.push_back(OVERRIDDEN_CELL_VISIBILITY);
}
@ -1290,7 +1290,7 @@ void RimEclipseView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
//--------------------------------------------------------------------------------------------------
void RimEclipseView::forceFaultVisibilityOn()
{
if (this->controllingViewLink() && this->controllingViewLink()->syncVisibleCells())
if (this->controllingViewLink() && this->controllingViewLink()->isVisibleCellsOveridden())
{
m_reservoirGridPartManager->setFaultForceVisibilityForGeometryType(OVERRIDDEN_CELL_VISIBILITY, true);
return;
@ -1316,7 +1316,7 @@ void RimEclipseView::forceFaultVisibilityOn()
std::vector<RivCellSetEnum> RimEclipseView::visibleFaultGeometryTypes() const
{
std::vector<RivCellSetEnum> faultParts;
if (this->controllingViewLink() && this->controllingViewLink()->syncVisibleCells())
if (this->controllingViewLink() && this->controllingViewLink()->isVisibleCellsOveridden())
{
faultParts.push_back(OVERRIDDEN_CELL_VISIBILITY);
if (this->faultCollection()->showFaultsOutsideFilters())

View File

@ -54,7 +54,7 @@ void RimGeoMechCellColors::updateIconState()
this->firstAnchestorOrThisOfType(rimView);
RimViewController* viewLink = RimViewLinker::viewLinkForView(rimView);
if (viewLink && viewLink->syncCellResult())
if (viewLink && viewLink->isResultColorControlled())
{
updateUiIconFromState(false);
}

View File

@ -159,7 +159,7 @@ void RimGeoMechPropertyFilterCollection::updateIconState()
RimGeoMechView* view = NULL;
this->firstAnchestorOrThisOfType(view);
RimViewController* viewLink = RimViewLinker::viewLinkForView(view);
if (viewLink && viewLink->syncPropertyFilters())
if (viewLink && viewLink->isPropertyFilterOveridden())
{
activeIcon = false;
}

View File

@ -57,21 +57,21 @@ RimViewController::RimViewController(void)
isActive.uiCapability()->setUiHidden(true);
QString defaultName = "View Config: Empty view";
CAF_PDM_InitField(&name, "Name", defaultName, "Managed View Name", "", "", "");
name.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_name, "Name", defaultName, "Managed View Name", "", "", "");
m_name.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", "");
m_managedView.uiCapability()->setUiChildrenHidden(true);
CAF_PDM_InitField(&syncCamera, "SyncCamera", true, "Camera", "", "", "");
CAF_PDM_InitField(&syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
CAF_PDM_InitField(&syncCellResult, "SyncCellResult", false, "Cell 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_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", "");
//syncVisibleCells.uiCapability()->setUiHidden(true); // For now
CAF_PDM_InitField(&syncRangeFilters, "SyncRangeFilters", true, "Range Filters", "", "", "");
CAF_PDM_InitField(&syncPropertyFilters, "SyncPropertyFilters", true,"Property Filters", "", "", "");
CAF_PDM_InitField(&m_syncRangeFilters, "SyncRangeFilters", true, "Range Filters", "", "", "");
CAF_PDM_InitField(&m_syncPropertyFilters, "SyncPropertyFilters", true,"Property Filters", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -148,22 +148,22 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
if (changedField == &isActive)
{
updateDisplayNameAndIcon();
if (syncCamera()) doSyncCamera();
if (syncTimeStep()) doSyncTimeStep();
if (syncCellResult()) doSyncCellResult();
if (m_syncCamera()) doSyncCamera();
if (m_syncTimeStep()) doSyncTimeStep();
if (m_syncCellResult()) doSyncCellResult();
updateOverrides();
}
else if (changedField == &syncCamera && syncCamera())
else if (changedField == &m_syncCamera && m_syncCamera())
{
doSyncCamera();
}
else if (changedField == &syncTimeStep && syncTimeStep())
else if (changedField == &m_syncTimeStep && m_syncTimeStep())
{
doSyncTimeStep();
}
else if (changedField == &syncCellResult)
else if (changedField == &m_syncCellResult)
{
if (syncCellResult())
if (m_syncCellResult())
{
doSyncCellResult();
}
@ -179,11 +179,11 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
}
}
}
else if (changedField == &syncRangeFilters)
else if (changedField == &m_syncRangeFilters)
{
updateOverrides();
}
else if (changedField == &syncPropertyFilters)
else if (changedField == &m_syncPropertyFilters)
{
updateOverrides();
}
@ -195,16 +195,16 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
{
RimViewLinker* viewLinker = ownerViewLinker();
if (syncCellResult())
if (m_syncCellResult())
{
viewLinker->updateCellResult();
}
if (syncCamera())
if (m_syncCamera())
{
viewLinker->updateCamera(m_managedView);
}
name = RimViewLinker::displayNameForView(m_managedView);
m_name = RimViewLinker::displayNameForView(m_managedView);
}
PdmObjectHandle* prevValue = oldValue.value<caf::PdmPointer<PdmObjectHandle> >().rawPtr();
@ -229,7 +229,7 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
updateOptionSensitivity();
updateDisplayNameAndIcon();
name.uiCapability()->updateConnectedEditors();
m_name.uiCapability()->updateConnectedEditors();
}
else if (&m_syncVisibleCells == changedField)
{
@ -300,7 +300,7 @@ void RimViewController::updateOverrides()
manEclView->updateIconStateForFilterCollections();
}
if (syncVisibleCells())
if (isVisibleCellsOveridden())
{
m_managedView->setOverrideRangeFilterCollection(NULL);
if (manEclView) manEclView->setOverridePropertyFilterCollection(NULL);
@ -309,7 +309,7 @@ void RimViewController::updateOverrides()
}
else
{
if (syncRangeFilters)
if (m_syncRangeFilters)
{
m_managedView->setOverrideRangeFilterCollection(masterView->rangeFilterCollection());
}
@ -324,7 +324,7 @@ void RimViewController::updateOverrides()
if (manEclView)
{
if (syncPropertyFilters)
if (m_syncPropertyFilters)
{
manEclView->setOverridePropertyFilterCollection(masterEclipseView->propertyFilterCollection());
}
@ -340,7 +340,7 @@ void RimViewController::updateOverrides()
{
if (manGeoView)
{
if (syncPropertyFilters)
if (m_syncPropertyFilters)
{
manGeoView->setOverridePropertyFilterCollection(masterGeoView->propertyFilterCollection());
}
@ -396,19 +396,19 @@ void RimViewController::updateOptionSensitivity()
if (isMasterAndDependentViewDifferentType)
{
this->syncCellResult.uiCapability()->setUiReadOnly(true);
this->syncCellResult = false;
this->syncRangeFilters.uiCapability()->setUiReadOnly(true);
this->syncRangeFilters = false;
this->syncPropertyFilters.uiCapability()->setUiReadOnly(true);
this->syncPropertyFilters = false;
this->m_syncCellResult.uiCapability()->setUiReadOnly(true);
this->m_syncCellResult = false;
this->m_syncRangeFilters.uiCapability()->setUiReadOnly(true);
this->m_syncRangeFilters = false;
this->m_syncPropertyFilters.uiCapability()->setUiReadOnly(true);
this->m_syncPropertyFilters = false;
}
else
{
this->syncCellResult.uiCapability()->setUiReadOnly(false);
this->m_syncCellResult.uiCapability()->setUiReadOnly(false);
this->syncRangeFilters.uiCapability()->setUiReadOnly(false);
this->syncPropertyFilters.uiCapability()->setUiReadOnly(false);
this->m_syncRangeFilters.uiCapability()->setUiReadOnly(false);
this->m_syncPropertyFilters.uiCapability()->setUiReadOnly(false);
}
m_syncVisibleCells.uiCapability()->setUiReadOnly(!this->isMasterAndDepViewDifferentType());
@ -444,14 +444,14 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Link Options");
scriptGroup->add(&syncCamera);
scriptGroup->add(&syncTimeStep);
scriptGroup->add(&syncCellResult);
scriptGroup->add(&m_syncCamera);
scriptGroup->add(&m_syncTimeStep);
scriptGroup->add(&m_syncCellResult);
caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup("Link Cell Filters");
visibleCells->add(&m_syncVisibleCells);
visibleCells->add(&syncRangeFilters);
visibleCells->add(&syncPropertyFilters);
visibleCells->add(&m_syncRangeFilters);
visibleCells->add(&m_syncPropertyFilters);
}
@ -460,7 +460,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
//--------------------------------------------------------------------------------------------------
void RimViewController::updateDisplayNameAndIcon()
{
RimViewLinker::findNameAndIconFromView(&name.v(), &m_originalIcon, managedView());
RimViewLinker::findNameAndIconFromView(&m_name.v(), &m_originalIcon, managedView());
RimViewLinker::applyIconEnabledState(this, m_originalIcon, !isActive());
}
@ -623,11 +623,98 @@ bool RimViewController::isMasterAndDepViewDifferentType()
return isMasterAndDependentViewDifferentType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView()
{
if (!this->isActive) return;
if (this->isVisibleCellsOveridden()
|| this->m_syncPropertyFilters()
|| this->m_syncRangeFilters()
)
{
if (this->managedView())
{
this->managedView()->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::syncVisibleCells()
void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType)
{
if (!this->isActive) return;
if (this->isVisibleCellsOveridden()
|| this->m_syncPropertyFilters()
|| this->m_syncRangeFilters()
)
{
if (this->managedView())
{
if (this->isVisibleCellsOveridden()) {
this->managedView()->scheduleGeometryRegen(OVERRIDDEN_CELL_VISIBILITY);
}
else{
this->managedView()->scheduleGeometryRegen(geometryType);
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isCameraLinked()
{
if (ownerViewLinker()->isActive() && this->isActive())
{
return m_syncCamera;
}
else
{
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isTimeStepLinked()
{
if (ownerViewLinker()->isActive() && this->isActive())
{
return m_syncTimeStep;
}
else
{
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isResultColorControlled()
{
if (ownerViewLinker()->isActive() && this->isActive())
{
return m_syncCellResult;
}
else
{
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isVisibleCellsOveridden()
{
if (isMasterAndDepViewDifferentType())
{
@ -646,46 +733,34 @@ bool RimViewController::syncVisibleCells()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView()
bool RimViewController::isRangeFilterOveridden()
{
if (!this->isActive) return;
if (this->syncVisibleCells()
|| this->syncPropertyFilters()
|| this->syncRangeFilters()
)
if (ownerViewLinker()->isActive() && this->isActive())
{
if (this->managedView())
{
this->managedView()->scheduleCreateDisplayModelAndRedraw();
}
return m_syncRangeFilters;
}
else
{
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType)
bool RimViewController::isPropertyFilterOveridden()
{
if (!this->isActive) return;
if (this->syncVisibleCells()
|| this->syncPropertyFilters()
|| this->syncRangeFilters()
)
if (ownerViewLinker()->isActive() && this->isActive())
{
if (this->managedView())
{
if (this->syncVisibleCells()) {
this->managedView()->scheduleGeometryRegen(OVERRIDDEN_CELL_VISIBILITY);
}
else{
this->managedView()->scheduleGeometryRegen(geometryType);
}
}
return m_syncPropertyFilters;
}
else
{
return false;
}
}

View File

@ -55,19 +55,18 @@ public:
RimViewLinker* ownerViewLinker();
const RigCaseToCaseCellMapper* cellMapper();
bool isCameraLinked();
bool isTimeStepLinked();
// Linked (both ways) properties
caf::PdmField<bool> syncCamera;
caf::PdmField<bool> syncTimeStep;
bool isResultColorControlled();
bool isVisibleCellsOveridden();
bool isRangeFilterOveridden();
bool isPropertyFilterOveridden();
// Overridden properties
caf::PdmField<bool> syncCellResult;
bool syncVisibleCells();
caf::PdmField<bool> syncRangeFilters;
caf::PdmField<bool> syncPropertyFilters;
void scheduleCreateDisplayModelAndRedrawForDependentView();
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType);
void scheduleCreateDisplayModelAndRedrawForDependentView();
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType);
void updateOverrides();
void updateOptionSensitivity();
void removeOverrides();
@ -82,7 +81,7 @@ protected: // Pdm overridden methods
virtual void initAfterRead();
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_name; }
virtual caf::PdmFieldHandle* objectToggleField() { return &isActive; }
private:
@ -96,9 +95,18 @@ private:
RimGeoMechView* managedGeoView();
private:
caf::PdmField<QString> name;
caf::PdmField<QString> m_name;
caf::PdmPtrField<RimView*> m_managedView;
caf::PdmField<bool> m_syncCamera;
caf::PdmField<bool> m_syncTimeStep;
// Overridden properties
caf::PdmField<bool> m_syncCellResult;
caf::PdmField<bool> m_syncRangeFilters;
caf::PdmField<bool> m_syncVisibleCells;
caf::PdmField<bool> m_syncPropertyFilters;
QIcon m_originalIcon;
cvf::ref<RigCaseToCaseCellMapper> m_caseToCaseCellMapper;

View File

@ -93,7 +93,7 @@ void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep)
RimViewController* sourceViewLink = sourceView->controllingViewLink();
CVF_ASSERT(sourceViewLink);
if (!sourceViewLink->isActive() || !sourceViewLink->syncTimeStep())
if (!sourceViewLink->isActive() || !sourceViewLink->isTimeStepLinked())
{
return;
}
@ -112,7 +112,7 @@ void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep)
if (viewLink->managedView() && viewLink->managedView() != sourceView)
{
if (viewLink->syncTimeStep() && viewLink->managedView()->viewer())
if (viewLink->isTimeStepLinked() && viewLink->managedView()->viewer())
{
viewLink->managedView()->viewer()->setCurrentFrame(timeStep);
viewLink->managedView()->viewer()->animationControl()->setCurrentFrameOnly(timeStep);
@ -145,7 +145,7 @@ void RimViewLinker::updateCellResult()
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
if (eclipeView)
{
if (viewLink->syncCellResult())
if (viewLink->isResultColorControlled())
{
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
@ -175,7 +175,7 @@ void RimViewLinker::updateCellResult()
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(rimView);
if (geoView)
{
if (viewLink->syncCellResult())
if (viewLink->isResultColorControlled())
{
geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress());
geoView->scheduleCreateDisplayModelAndRedraw();
@ -240,7 +240,7 @@ void RimViewLinker::allViewsForCameraSync(RimView* source, std::vector<RimView*>
{
if (viewLinks[i]->managedView() && source != viewLinks[i]->managedView())
{
if (viewLinks[i]->isActive() && viewLinks[i]->syncCamera())
if (viewLinks[i]->isActive() && viewLinks[i]->isCameraLinked())
{
views.push_back(viewLinks[i]->managedView());
}
@ -345,7 +345,7 @@ void RimViewLinker::updateScaleZ(RimView* sourceView, double scaleZ)
RimViewController* sourceViewLink = viewLinkForView(sourceView);
CVF_ASSERT(sourceViewLink);
if (!sourceViewLink->isActive() || !sourceViewLink->syncCamera())
if (!sourceViewLink->isActive() || !sourceViewLink->isCameraLinked())
{
return;
}
@ -523,7 +523,7 @@ void RimViewLinker::updateCamera(RimView* sourceView)
RimViewController* viewLink = sourceView->controllingViewLink();
if (viewLink)
{
if ((!viewLink->isActive() || !viewLink->syncCamera()))
if ((!viewLink->isActive() || !viewLink->isCameraLinked()))
{
return;
}