Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "RimViewController.h"
#include "RimViewLinker.h"

#include "cafPdmObjectScriptingCapability.h"

CAF_PDM_SOURCE_INIT( RimGeoMechCellColors, "GeoMechResultSlot" );

//--------------------------------------------------------------------------------------------------
Expand All @@ -32,6 +34,8 @@ CAF_PDM_SOURCE_INIT( RimGeoMechCellColors, "GeoMechResultSlot" );
RimGeoMechCellColors::RimGeoMechCellColors()
: legendConfigChanged( this )
{
CAF_PDM_InitScriptableObjectWithNameAndComment( "Color Result", ":/CellResult.png", "", "", "GeoMechCellColors", "Geomechanical cell colors" );

CAF_PDM_InitFieldNoDefault( &legendConfig, "LegendDefinition", "Color Legend" );
legendConfig = new RimRegularLegendConfig();
legendConfig->changed.connect( this, &RimGeoMechCellColors::onLegendConfigChanged );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include "RimViewLinker.h"
#include "RimWellPath.h"

#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiTreeSelectionEditor.h"

Expand Down Expand Up @@ -77,15 +79,15 @@ CAF_PDM_SOURCE_INIT( RimGeoMechResultDefinition, "GeoMechResultDefinition" );
//--------------------------------------------------------------------------------------------------
RimGeoMechResultDefinition::RimGeoMechResultDefinition()
{
CAF_PDM_InitObject( "Color Result", ":/CellResult.png" );
CAF_PDM_InitScriptableObjectWithNameAndComment( "Color Result", ":/CellResult.png", "", "", "GeoMechResult", "A geomechanical result definition" );

CAF_PDM_InitFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position" );
CAF_PDM_InitScriptableFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position" );
m_resultPositionType.uiCapability()->setUiHidden( true );

CAF_PDM_InitField( &m_resultFieldName, "ResultFieldName", QString( "" ), "Field Name" );
CAF_PDM_InitScriptableField( &m_resultFieldName, "ResultFieldName", QString( "" ), "Field Name" );
m_resultFieldName.uiCapability()->setUiHidden( true );

CAF_PDM_InitField( &m_resultComponentName, "ResultComponentName", QString( "" ), "Component" );
CAF_PDM_InitScriptableField( &m_resultComponentName, "ResultComponentName", QString( "" ), "Component" );
m_resultComponentName.uiCapability()->setUiHidden( true );

CAF_PDM_InitField( &m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigFemResultAddress::noTimeLapseValue(), "Base Time Step" );
Expand Down Expand Up @@ -541,11 +543,19 @@ void RimGeoMechResultDefinition::initAfterRead()
{
if ( m_resultComponentName() == "STM" || m_resultComponentName() == "SEM" ) m_resultComponentName = "SM";

updateUiFieldsFromActiveResult();

m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly( resultPositionType() == RIG_WELLPATH_DERIVED );
}
Comment on lines +547 to +549

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line not part of the updateUiFieldsFromActiveResult method?


//--------------------------------------------------------------------------------------------------
/// Sync the UI fields after the result fields are set directly, e.g. from scripting
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition::updateUiFieldsFromActiveResult()
{
m_resultPositionTypeUiField = m_resultPositionType;
m_resultVariableUiField = composeFieldCompString( m_resultFieldName(), m_resultComponentName() );
m_compactionRefLayerUiField = m_compactionRefLayer;

m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly( resultPositionType() == RIG_WELLPATH_DERIVED );
}

//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class RimGeoMechResultDefinition : public RimFemResultObserver, public RimChecka
RigGeoMechCaseData* ownerCaseData() const;
bool hasResult();
void loadResult();
void updateUiFieldsFromActiveResult();
void setAddWellPathDerivedResults( bool addWellPathDerivedResults );

RigFemResultAddress resultAddress() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#include "cafDisplayCoordTransform.h"
#include "cafFrameAnimationControl.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafProgressInfo.h"

Expand All @@ -96,7 +97,7 @@ RimGeoMechView::RimGeoMechView()
{
CAF_PDM_InitScriptableObject( "Geomechanical View", ":/3DViewGeoMech16x16.png", "", "The Geomechanical 3d View" );

CAF_PDM_InitFieldNoDefault( &cellResult, "GridCellResult", "Color Result", ":/CellResult.png" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &cellResult, "GridCellResult", "CellResult", "Color Result", ":/CellResult.png" );
cellResult = new RimGeoMechCellColors();

CAF_PDM_InitFieldNoDefault( &m_tensorResults, "TensorResults", "Tensor Results" );
Expand Down
4 changes: 4 additions & 0 deletions GrpcInterface/Python/rips/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ def extract_address(address) -> int:
@add_method(View)
def case(self):
"""Get the case the view belongs to"""
# Geomechanical views are children of their case
if not hasattr(self, "eclipse_case"):
return self.ancestor(rips.case.Case)

project = self.ancestor(rips.project.Project)
Comment on lines +205 to 209

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer match on the type of self instead of checking for attributes it does have?


eclipse_case_addr = extract_address(self.eclipse_case)
Expand Down
6 changes: 6 additions & 0 deletions GrpcInterface/RiaGrpcPdmObjectService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "RiaOpenTelemetryManager.h"

#include "RimEclipseResultDefinition.h"
#include "RimGeoMechResultDefinition.h"
#include "RimProject.h"

#include "cafPdmAbstractFieldScriptingCapability.h"
Expand Down Expand Up @@ -458,6 +459,11 @@ grpc::Status RiaGrpcPdmObjectService::UpdateExistingPdmObject( grpc::ServerConte
resultDefinition->updateUiFieldsFromActiveResult();
resultDefinition->loadResult();
}
if ( auto geoMechResultDefinition = dynamic_cast<RimGeoMechResultDefinition*>( matchingObject ) )
{
geoMechResultDefinition->updateUiFieldsFromActiveResult();
geoMechResultDefinition->loadResult();
}

matchingObject->updateAllRequiredEditors();
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
Expand Down