#5019 Add an enable separate results button to each intersection

This commit is contained in:
Jacob Støren
2019-11-25 13:31:21 +01:00
parent 4bafefa225
commit 919f035a48
3 changed files with 22 additions and 7 deletions

View File

@@ -146,12 +146,23 @@ void RimIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue ) const QVariant& newValue )
{ {
if ( changedField == &m_isActive || changedField == &type || changedField == &direction || changedField == &wellPath || // clang-format off
changedField == &simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || if ( changedField == &m_isActive ||
changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells ) changedField == &type ||
changedField == &direction ||
changedField == &wellPath ||
changedField == &simulationWell ||
changedField == &m_branchIndex ||
changedField == &m_extentLength ||
changedField == &m_lengthUp ||
changedField == &m_lengthDown ||
changedField == &m_showInactiveCells ||
changedField == &m_useSeparateDataSource ||
changedField == &m_separateDataSource )
{ {
rebuildGeometryAndScheduleCreateDisplayModel(); rebuildGeometryAndScheduleCreateDisplayModel();
} }
// clang-format on
if ( changedField == &simulationWell || changedField == &m_isActive || changedField == &type ) if ( changedField == &simulationWell || changedField == &m_isActive || changedField == &type )
{ {
@@ -931,4 +942,3 @@ double RimIntersection::azimuthInRadians( cvf::Vec3d vec )
{ {
return cvf::GeometryTools::getAngle( -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS, vec ); return cvf::GeometryTools::getAngle( -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS, vec );
} }

View File

@@ -42,6 +42,7 @@ RimIntersectionHandle::RimIntersectionHandle()
CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" ); CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" );
m_isActive.uiCapability()->setUiHidden( true ); m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" ); CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
CAF_PDM_InitField( &m_useSeparateDataSource, "UseSeparateIntersectionDataSource", true, "Enable", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source", "", "", "" );
} }
@@ -97,6 +98,8 @@ RimIntersectionResultDefinition* RimIntersectionHandle::activeSeparateResultDefi
{ {
updateDefaultSeparateDataSource(); updateDefaultSeparateDataSource();
if ( !m_useSeparateDataSource ) return nullptr;
if ( !m_separateDataSource ) return nullptr; if ( !m_separateDataSource ) return nullptr;
if ( !m_separateDataSource->isActive() ) return nullptr; if ( !m_separateDataSource->isActive() ) return nullptr;
@@ -125,8 +128,6 @@ QList<caf::PdmOptionItemInfo>
std::vector<RimIntersectionResultDefinition*> iResDefs = std::vector<RimIntersectionResultDefinition*> iResDefs =
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions(); view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
for ( auto iresdef : iResDefs ) for ( auto iresdef : iResDefs )
{ {
options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) ); options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) );
@@ -170,9 +171,12 @@ void RimIntersectionHandle::defineSeparateDataSourceUi( QString uiConfigName, ca
inactiveText = " (Inactive)"; inactiveText = " (Inactive)";
} }
caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroup( "Separate Data Source Reference" + inactiveText ); caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroup( "Separate Result Reference" + inactiveText );
separateResultsGroup->setCollapsedByDefault( true ); separateResultsGroup->setCollapsedByDefault( true );
separateResultsGroup->add( &m_useSeparateDataSource );
separateResultsGroup->add( &m_separateDataSource ); separateResultsGroup->add( &m_separateDataSource );
m_separateDataSource.uiCapability()->setUiReadOnly( !m_useSeparateDataSource() );
m_separateDataSource.uiCapability()->setUiName( "Source" + inactiveText ); m_separateDataSource.uiCapability()->setUiName( "Source" + inactiveText );
} }

View File

@@ -57,5 +57,6 @@ protected:
caf::PdmField<QString> m_name; caf::PdmField<QString> m_name;
caf::PdmField<bool> m_isActive; caf::PdmField<bool> m_isActive;
caf::PdmField<bool> m_showInactiveCells; caf::PdmField<bool> m_showInactiveCells;
caf::PdmField<bool> m_useSeparateDataSource;
caf::PdmPtrField<RimIntersectionResultDefinition*> m_separateDataSource; caf::PdmPtrField<RimIntersectionResultDefinition*> m_separateDataSource;
}; };