mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 07:26:03 -06:00
#5019 Move RimIntersectionHandle to separate files Use in RimIntersectionBox
This commit is contained in:
parent
9ed3d8babc
commit
612332cbbc
@ -54,7 +54,7 @@ void RicAppendIntersectionBoxFeature::onActionTriggered( bool isChecked )
|
||||
if ( coll )
|
||||
{
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = QString( "Intersection Box" );
|
||||
intersectionBox->setName( "Intersection Box" );
|
||||
|
||||
coll->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
|
||||
|
@ -59,7 +59,7 @@ void RicIntersectionBoxAtPosFeature::onActionTriggered( bool isChecked )
|
||||
CVF_ASSERT( coll );
|
||||
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = QString( "Intersection box" );
|
||||
intersectionBox->setName( "Intersection box" );
|
||||
|
||||
coll->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
|
||||
|
@ -44,7 +44,7 @@ void RicIntersectionFeatureImpl::createIntersectionBoxSlize( const QString&
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
|
||||
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = name;
|
||||
intersectionBox->setName( name );
|
||||
|
||||
coll->appendIntersectionBoxNoUpdate( intersectionBox );
|
||||
intersectionBox->setToDefaultSizeSlice( plane, domainCoord );
|
||||
|
@ -111,8 +111,8 @@ void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked )
|
||||
intersectionBoxObjects[i]->xmlCapability()->copyByXmlSerialization(
|
||||
caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
QString nameOfCopy = QString( "Copy of " ) + intersectionBox->name;
|
||||
intersectionBox->name = nameOfCopy;
|
||||
QString nameOfCopy = QString( "Copy of " ) + intersectionBox->name();
|
||||
intersectionBox->setName(nameOfCopy);
|
||||
|
||||
if ( i == intersectionBoxObjects.size() - 1 )
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ void RicHideIntersectionBoxFeature::onActionTriggered( bool isChecked )
|
||||
RimIntersectionBox* intersectionBox = dynamic_cast<RimIntersectionBox*>( generalSelectionItem->m_object );
|
||||
if ( intersectionBox )
|
||||
{
|
||||
intersectionBox->isActive = false;
|
||||
intersectionBox->setActive(false);
|
||||
intersectionBox->updateConnectedEditors();
|
||||
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
@ -370,7 +370,7 @@ cvf::ref<RivIntersectionHexGridInterface> RivIntersectionBoxPartMgr::createHexGr
|
||||
|
||||
return new RivEclipseIntersectionGrid( grid,
|
||||
eclipseView->currentActiveCellInfo(),
|
||||
m_rimIntersectionBox->showInactiveCells() );
|
||||
m_rimIntersectionBox->isInactiveCellsVisible() );
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
|
@ -87,6 +87,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileChannel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionHandle.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultDefinition.h
|
||||
@ -231,6 +232,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileChannel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionHandle.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultDefinition.cpp
|
||||
|
@ -932,166 +932,3 @@ double RimIntersection::azimuthInRadians( cvf::Vec3d vec )
|
||||
return cvf::GeometryTools::getAngle( -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS, vec );
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimIntersectionHandle, "RimIntersectionHandle" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionHandle::RimIntersectionHandle()
|
||||
{
|
||||
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
|
||||
CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionHandle::~RimIntersectionHandle() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimIntersectionHandle::name() const
|
||||
{
|
||||
return m_name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::setName( const QString& newName )
|
||||
{
|
||||
m_name = newName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimIntersectionHandle::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::setActive( bool isActive )
|
||||
{
|
||||
m_isActive = isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimIntersectionHandle::isInactiveCellsVisible() const
|
||||
{
|
||||
return m_showInactiveCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionResultDefinition* RimIntersectionHandle::activeSeparateResultDefinition()
|
||||
{
|
||||
updateDefaultSeparateDataSource();
|
||||
|
||||
if ( !m_separateDataSource ) return nullptr;
|
||||
|
||||
if ( !m_separateDataSource->isActive() ) return nullptr;
|
||||
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
|
||||
if ( !view->separateIntersectionResultsCollection()->isActive() ) return nullptr;
|
||||
|
||||
return m_separateDataSource;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimIntersectionHandle::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_separateDataSource )
|
||||
{
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
|
||||
std::vector<RimIntersectionResultDefinition*> iResDefs =
|
||||
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
for ( auto iresdef : iResDefs )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionHandle::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionHandle::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::initAfterRead()
|
||||
{
|
||||
updateDefaultSeparateDataSource();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
QString inactiveText;
|
||||
if ( !this->activeSeparateResultDefinition() )
|
||||
{
|
||||
inactiveText = " (Inactive)";
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroup( "Separate Data Source Reference" + inactiveText );
|
||||
separateResultsGroup->setCollapsedByDefault( true );
|
||||
separateResultsGroup->add( &m_separateDataSource );
|
||||
m_separateDataSource.uiCapability()->setUiName( "Source" + inactiveText );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::updateDefaultSeparateDataSource()
|
||||
{
|
||||
if ( m_separateDataSource() == nullptr )
|
||||
{
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
|
||||
std::vector<RimIntersectionResultDefinition*> iResDefs =
|
||||
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
|
||||
if ( iResDefs.size() )
|
||||
{
|
||||
m_separateDataSource = iResDefs[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "RimIntersectionHandle.h"
|
||||
|
||||
class RimWellPath;
|
||||
class RivIntersectionPartMgr;
|
||||
@ -41,41 +42,6 @@ class PdmUiListEditorAttribute;
|
||||
class PdmUiPushButtonEditorAttribute;
|
||||
} // namespace caf
|
||||
|
||||
class RimIntersectionHandle : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimIntersectionHandle();
|
||||
~RimIntersectionHandle() override;
|
||||
|
||||
QString name() const;
|
||||
void setName( const QString& newName );
|
||||
|
||||
bool isActive() const;
|
||||
void setActive( bool isActive );
|
||||
|
||||
bool isInactiveCellsVisible() const;
|
||||
|
||||
RimIntersectionResultDefinition* activeSeparateResultDefinition();
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
void defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||
void updateDefaultSeparateDataSource();
|
||||
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<bool> m_showInactiveCells;
|
||||
|
||||
caf::PdmPtrField<RimIntersectionResultDefinition*> m_separateDataSource;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
|
@ -55,10 +55,6 @@ RimIntersectionBox::RimIntersectionBox()
|
||||
{
|
||||
CAF_PDM_InitObject( "Intersection Box", ":/IntersectionBox16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
|
||||
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
|
||||
isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_singlePlaneState,
|
||||
"singlePlaneState",
|
||||
caf::AppEnum<SinglePlaneState>( SinglePlaneState::PLANE_STATE_NONE ),
|
||||
@ -85,7 +81,6 @@ RimIntersectionBox::RimIntersectionBox()
|
||||
CAF_PDM_InitField( &m_maxDepth, "MaxDepth", 0.0, "Max", "", "", "" );
|
||||
m_maxDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
|
||||
CAF_PDM_InitField( &m_xySliderStepSize, "xySliderStepSize", 1.0, "XY Slider Step Size", "", "", "" );
|
||||
CAF_PDM_InitField( &m_depthSliderStepSize, "DepthSliderStepSize", 0.5, "Depth Slider Step Size", "", "", "" );
|
||||
|
||||
@ -355,7 +350,7 @@ void RimIntersectionBox::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
}
|
||||
}
|
||||
|
||||
if ( changedField != &name )
|
||||
if ( changedField != &m_name )
|
||||
{
|
||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
}
|
||||
@ -444,12 +439,12 @@ void RimIntersectionBox::defineEditorAttribute( const caf::PdmFieldHandle* field
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &name );
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Options" );
|
||||
group->add( &m_singlePlaneState );
|
||||
group->add( &showInactiveCells );
|
||||
group->add( &m_showInactiveCells );
|
||||
}
|
||||
|
||||
cvf::BoundingBox cellsBoundingBox = currentCellBoundingBox();
|
||||
@ -482,6 +477,8 @@ void RimIntersectionBox::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
}
|
||||
|
||||
uiOrdering.add( &m_show3DManipulator );
|
||||
|
||||
this->defineSeparateDataSourceUi(uiConfigName, uiOrdering);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -489,6 +486,7 @@ void RimIntersectionBox::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::initAfterRead()
|
||||
{
|
||||
RimIntersectionHandle::initAfterRead();
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@ -524,21 +522,6 @@ void RimIntersectionBox::slotUpdateGeometry( const cvf::Vec3d& origin, const cvf
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionBox::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionBox::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RimIntersectionHandle.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
@ -41,7 +43,7 @@ class ModelBasicList;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimIntersectionBox : public QObject, public caf::PdmObject
|
||||
class RimIntersectionBox : public QObject, public RimIntersectionHandle
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
@ -60,11 +62,6 @@ public:
|
||||
RimIntersectionBox();
|
||||
~RimIntersectionBox() override;
|
||||
|
||||
// Fields
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmField<bool> showInactiveCells;
|
||||
|
||||
cvf::Mat4d boxOrigin() const;
|
||||
cvf::Vec3d boxSize() const;
|
||||
SinglePlaneState singlePlaneState() const;
|
||||
@ -79,9 +76,6 @@ public:
|
||||
void setToDefaultSizeSlice( SinglePlaneState plane, const cvf::Vec3d& position );
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
@ -87,7 +87,7 @@ void RimIntersectionCollection::applySingleColorEffect()
|
||||
|
||||
for ( RimIntersectionBox* cs : m_intersectionBoxes )
|
||||
{
|
||||
if ( cs->isActive )
|
||||
if ( cs->isActive() )
|
||||
{
|
||||
cs->intersectionBoxPartMgr()->applySingleColorEffect();
|
||||
}
|
||||
@ -113,7 +113,7 @@ void RimIntersectionCollection::updateCellResultColor( size_t
|
||||
|
||||
for ( RimIntersectionBox* cs : m_intersectionBoxes )
|
||||
{
|
||||
if ( cs->isActive )
|
||||
if ( cs->isActive() )
|
||||
{
|
||||
cs->intersectionBoxPartMgr()->updateCellResultColor( timeStepIndex );
|
||||
}
|
||||
|
242
ApplicationCode/ProjectDataModel/RimIntersectionHandle.cpp
Normal file
242
ApplicationCode/ProjectDataModel/RimIntersectionHandle.cpp
Normal file
@ -0,0 +1,242 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimIntersectionHandle.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimIntersectionHandle, "RimIntersectionHandle" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionHandle::RimIntersectionHandle()
|
||||
{
|
||||
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
|
||||
CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionHandle::~RimIntersectionHandle() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimIntersectionHandle::name() const
|
||||
{
|
||||
return m_name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::setName( const QString& newName )
|
||||
{
|
||||
m_name = newName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimIntersectionHandle::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::setActive( bool isActive )
|
||||
{
|
||||
m_isActive = isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimIntersectionHandle::isInactiveCellsVisible() const
|
||||
{
|
||||
return m_showInactiveCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionResultDefinition* RimIntersectionHandle::activeSeparateResultDefinition()
|
||||
{
|
||||
updateDefaultSeparateDataSource();
|
||||
|
||||
if ( !m_separateDataSource ) return nullptr;
|
||||
|
||||
if ( !m_separateDataSource->isActive() ) return nullptr;
|
||||
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
|
||||
if ( !view->separateIntersectionResultsCollection()->isActive() ) return nullptr;
|
||||
|
||||
return m_separateDataSource;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimIntersectionHandle::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_separateDataSource )
|
||||
{
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
|
||||
std::vector<RimIntersectionResultDefinition*> iResDefs =
|
||||
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
for ( auto iresdef : iResDefs )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionHandle::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionHandle::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::initAfterRead()
|
||||
{
|
||||
updateDefaultSeparateDataSource();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
QString inactiveText;
|
||||
if ( !this->activeSeparateResultDefinition() )
|
||||
{
|
||||
inactiveText = " (Inactive)";
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroup( "Separate Data Source Reference" + inactiveText );
|
||||
separateResultsGroup->setCollapsedByDefault( true );
|
||||
separateResultsGroup->add( &m_separateDataSource );
|
||||
m_separateDataSource.uiCapability()->setUiName( "Source" + inactiveText );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionHandle::updateDefaultSeparateDataSource()
|
||||
{
|
||||
if ( m_separateDataSource() == nullptr )
|
||||
{
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
|
||||
std::vector<RimIntersectionResultDefinition*> iResDefs =
|
||||
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
|
||||
if ( iResDefs.size() )
|
||||
{
|
||||
m_separateDataSource = iResDefs[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RivIntersectionHexGridInterface> RimIntersectionHandle::createHexGridInterface()
|
||||
{
|
||||
RimIntersectionResultDefinition* resDef = activeSeparateResultDefinition();
|
||||
if ( resDef && resDef->activeCase() )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( resDef->activeCase() );
|
||||
if ( eclipseCase && eclipseCase->eclipseCaseData() )
|
||||
{
|
||||
return new RivEclipseIntersectionGrid( eclipseCase->eclipseCaseData()->mainGrid(),
|
||||
eclipseCase->eclipseCaseData()->activeCellInfo(
|
||||
resDef->eclipseResultDefinition()->porosityModel() ),
|
||||
this->isInactiveCellsVisible() );
|
||||
}
|
||||
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( resDef->activeCase() );
|
||||
|
||||
if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() )
|
||||
{
|
||||
RigFemPart* femPart = geomCase->geoMechData()->femParts()->part( 0 );
|
||||
return new RivFemIntersectionGrid( femPart );
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
this->firstAncestorOrThisOfType( eclipseView );
|
||||
if ( eclipseView )
|
||||
{
|
||||
RigMainGrid* grid = eclipseView->mainGrid();
|
||||
return new RivEclipseIntersectionGrid( grid, eclipseView->currentActiveCellInfo(), this->isInactiveCellsVisible() );
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
this->firstAncestorOrThisOfType( geoView );
|
||||
if ( geoView && geoView->femParts() && geoView->femParts()->partCount() )
|
||||
{
|
||||
RigFemPart* femPart = geoView->femParts()->part( 0 );
|
||||
|
||||
return new RivFemIntersectionGrid( femPart );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
61
ApplicationCode/ProjectDataModel/RimIntersectionHandle.h
Normal file
61
ApplicationCode/ProjectDataModel/RimIntersectionHandle.h
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RimIntersectionResultDefinition;
|
||||
class RivIntersectionHexGridInterface;
|
||||
|
||||
class RimIntersectionHandle : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimIntersectionHandle();
|
||||
~RimIntersectionHandle() override;
|
||||
|
||||
QString name() const;
|
||||
void setName( const QString& newName );
|
||||
bool isActive() const;
|
||||
void setActive( bool isActive );
|
||||
bool isInactiveCellsVisible() const;
|
||||
|
||||
RimIntersectionResultDefinition* activeSeparateResultDefinition();
|
||||
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override final;
|
||||
caf::PdmFieldHandle* objectToggleField() override final;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
void defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||
void updateDefaultSeparateDataSource();
|
||||
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<bool> m_showInactiveCells;
|
||||
caf::PdmPtrField<RimIntersectionResultDefinition*> m_separateDataSource;
|
||||
};
|
@ -118,6 +118,30 @@ QString RimIntersectionResultDefinition::autoName() const
|
||||
return resultVarUiName + " " + timestepName + " " + caseName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RimIntersectionResultDefinition::activeCase() const
|
||||
{
|
||||
return m_case();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimEclipseResultDefinition* RimIntersectionResultDefinition::eclipseResultDefinition() const
|
||||
{
|
||||
return m_eclipseResultDefinition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimGeoMechResultDefinition* RimIntersectionResultDefinition::geoMechResultDefinition() const
|
||||
{
|
||||
return m_geomResultDefinition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -38,9 +38,13 @@ public:
|
||||
RimIntersectionResultDefinition();
|
||||
~RimIntersectionResultDefinition() override;
|
||||
|
||||
bool isActive();
|
||||
bool isActive();
|
||||
QString autoName() const;
|
||||
RimCase* activeCase() const;
|
||||
int timeStep() const { return m_timeStep();}
|
||||
|
||||
QString autoName() const;
|
||||
const RimEclipseResultDefinition* eclipseResultDefinition() const;
|
||||
const RimGeoMechResultDefinition* geoMechResultDefinition() const;
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
@ -41,7 +41,10 @@ RimIntersectionResultsDefinitionCollection::RimIntersectionResultsDefinitionColl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionResultsDefinitionCollection::~RimIntersectionResultsDefinitionCollection() {}
|
||||
RimIntersectionResultsDefinitionCollection::~RimIntersectionResultsDefinitionCollection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user