#5019 WIP: Made fields in IntersectionHandle protected

This commit is contained in:
Jacob Støren 2019-11-12 15:10:41 +01:00
parent 8fb3fbc097
commit 9ed3d8babc
11 changed files with 93 additions and 45 deletions

View File

@ -99,7 +99,7 @@ void RicAppendIntersectionFeatureCmd::redo()
CVF_ASSERT( m_intersectionCollection );
RimIntersection* intersection = new RimIntersection();
intersection->name = QString( "Intersection" );
intersection->setName( "Intersection" );
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
RimGridView* view = nullptr;

View File

@ -105,8 +105,8 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo()
{
CVF_ASSERT( m_intersectionCollection );
RimIntersection* intersection = new RimIntersection();
intersection->name = "Azimuth and Dip";
RimIntersection* intersection = new RimIntersection();
intersection->setName( "Azimuth and Dip" );
intersection->type = RimIntersection::CS_AZIMUTHLINE;
intersection->inputTwoAzimuthPointsFromViewerEnabled = true;

View File

@ -103,8 +103,8 @@ void RicNewPolylineIntersectionFeatureCmd::redo()
{
CVF_ASSERT( m_intersectionCollection );
RimIntersection* intersection = new RimIntersection();
intersection->name = "Polyline";
RimIntersection* intersection = new RimIntersection();
intersection->setName( "Polyline" );
intersection->type = RimIntersection::CS_POLYLINE;
intersection->inputPolyLineFromViewerEnabled = true;

View File

@ -102,9 +102,9 @@ void RicNewSimWellIntersectionCmd::redo()
CVF_ASSERT( m_simWell );
RimIntersection* intersection = new RimIntersection();
intersection->name = m_simWell->name;
intersection->type = RimIntersection::CS_SIMULATION_WELL;
intersection->simulationWell = m_simWell;
intersection->setName( m_simWell->name );
intersection->type = RimIntersection::CS_SIMULATION_WELL;
intersection->simulationWell = m_simWell;
m_intersectionCollection->appendIntersectionAndUpdate( intersection, false );
}

View File

@ -109,9 +109,9 @@ void RicNewWellPathIntersectionFeatureCmd::redo()
CVF_ASSERT( m_wellPath );
RimIntersection* intersection = new RimIntersection();
intersection->name = m_wellPath->name();
intersection->type = RimIntersection::CS_WELL_PATH;
intersection->wellPath = m_wellPath;
intersection->setName( m_wellPath->name() );
intersection->type = RimIntersection::CS_WELL_PATH;
intersection->wellPath = m_wellPath;
m_intersectionCollection->appendIntersectionAndUpdate( intersection, false );
}

View File

@ -89,8 +89,8 @@ void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked )
RimIntersection* intersection = dynamic_cast<RimIntersection*>(
intersectionObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
QString nameOfCopy = QString( "Copy of " ) + intersection->name;
intersection->name = nameOfCopy;
QString nameOfCopy = QString( "Copy of " ) + intersection->name();
intersection->setName( nameOfCopy );
if ( i == intersectionObjects.size() - 1 )
{

View File

@ -68,7 +68,7 @@ void RicHideIntersectionFeature::onActionTriggered( bool isChecked )
RimIntersection* intersection = dynamic_cast<RimIntersection*>( generalSelectionItem->m_object );
if ( intersection )
{
intersection->isActive = false;
intersection->setActive( false );
intersection->updateConnectedEditors();
activeView->scheduleCreateDisplayModelAndRedraw();

View File

@ -1011,7 +1011,7 @@ cvf::ref<RivIntersectionHexGridInterface> RivIntersectionPartMgr::createHexGridI
RigMainGrid* grid = eclipseView->mainGrid();
return new RivEclipseIntersectionGrid( grid,
eclipseView->currentActiveCellInfo(),
m_rimCrossSection->showInactiveCells() );
m_rimCrossSection->isInactiveCellsVisible() );
}
RimGeoMechView* geoView;

View File

@ -146,14 +146,14 @@ void RimIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &isActive || changedField == &type || changedField == &direction || changedField == &wellPath ||
if ( changedField == &m_isActive || changedField == &type || changedField == &direction || changedField == &wellPath ||
changedField == &simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength ||
changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &showInactiveCells )
changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells )
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
if ( changedField == &simulationWell || changedField == &isActive || changedField == &type )
if ( changedField == &simulationWell || changedField == &m_isActive || changedField == &type )
{
recomputeSimulationWellBranchData();
}
@ -163,7 +163,7 @@ void RimIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
updateName();
}
if ( changedField == &name )
if ( changedField == &m_name )
{
Rim2dIntersectionView* iView = correspondingIntersectionView();
if ( iView )
@ -223,7 +223,7 @@ void RimIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
void RimIntersection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &name );
uiOrdering.add( &m_name );
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup( "Intersecting Geometry" );
geometryGroup->add( &type );
@ -272,7 +272,7 @@ void RimIntersection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
optionsGroup->add( &inputExtrusionPointsFromViewerEnabled );
}
optionsGroup->add( &showInactiveCells );
optionsGroup->add( &m_showInactiveCells );
if ( type == CS_POLYLINE )
{
@ -283,7 +283,7 @@ void RimIntersection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
m_extentLength.uiCapability()->setUiReadOnly( false );
}
this->defineSeparateDataSourceUi(uiConfigName, uiOrdering);
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );
updateWellExtentDefaultValue();
@ -339,9 +339,9 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions( const caf:
options.push_back( caf::PdmOptionItemInfo( QString::number( bIdx + 1 ), QVariant::fromValue( bIdx ) ) );
}
}
else
else
{
options = RimIntersectionHandle::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
options = RimIntersectionHandle::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
}
return options;
@ -509,7 +509,7 @@ std::vector<cvf::Vec3d> RimIntersection::polyLinesForExtrusionDirection() const
//--------------------------------------------------------------------------------------------------
void RimIntersection::updateSimulationWellCenterline() const
{
if ( isActive() && type == CS_SIMULATION_WELL && simulationWell() )
if ( m_isActive() && type == CS_SIMULATION_WELL && simulationWell() )
{
if ( m_simulationWellBranchCenterlines.empty() )
{
@ -607,15 +607,15 @@ void RimIntersection::updateName()
{
if ( type == CS_SIMULATION_WELL && simulationWell() )
{
name = simulationWell()->name();
m_name = simulationWell()->name();
if ( branchIndex() != -1 )
{
name = name() + " Branch " + QString::number( branchIndex() + 1 );
m_name = m_name() + " Branch " + QString::number( branchIndex() + 1 );
}
}
else if ( type() == CS_WELL_PATH && wellPath() )
{
name = wellPath()->name();
m_name = wellPath()->name();
}
Rim2dIntersectionView* iView = correspondingIntersectionView();
@ -939,10 +939,10 @@ CAF_PDM_SOURCE_INIT( RimIntersectionHandle, "RimIntersectionHandle" );
//--------------------------------------------------------------------------------------------------
RimIntersectionHandle::RimIntersectionHandle()
{
CAF_PDM_InitField( &name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
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", "", "", "" );
}
@ -951,6 +951,46 @@ RimIntersectionHandle::RimIntersectionHandle()
//--------------------------------------------------------------------------------------------------
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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1002,7 +1042,7 @@ QList<caf::PdmOptionItemInfo>
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionHandle::userDescriptionField()
{
return &name;
return &m_name;
}
//--------------------------------------------------------------------------------------------------
@ -1010,7 +1050,7 @@ caf::PdmFieldHandle* RimIntersectionHandle::userDescriptionField()
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionHandle::objectToggleField()
{
return &isActive;
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
@ -1023,7 +1063,7 @@ void RimIntersectionHandle::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionHandle::defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimIntersectionHandle::defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
QString inactiveText;
if ( !this->activeSeparateResultDefinition() )

View File

@ -49,9 +49,13 @@ public:
RimIntersectionHandle();
~RimIntersectionHandle() override;
caf::PdmField<QString> name;
caf::PdmField<bool> isActive;
caf::PdmField<bool> showInactiveCells;
QString name() const;
void setName( const QString& newName );
bool isActive() const;
void setActive( bool isActive );
bool isInactiveCellsVisible() const;
RimIntersectionResultDefinition* activeSeparateResultDefinition();
@ -65,6 +69,10 @@ protected:
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;
};

View File

@ -79,7 +79,7 @@ void RimIntersectionCollection::applySingleColorEffect()
for ( RimIntersection* cs : m_intersections )
{
if ( cs->isActive )
if ( cs->isActive() )
{
cs->intersectionPartMgr()->applySingleColorEffect();
}
@ -105,7 +105,7 @@ void RimIntersectionCollection::updateCellResultColor( size_t
for ( RimIntersection* cs : m_intersections )
{
if ( cs->isActive )
if ( cs->isActive() )
{
cs->intersectionPartMgr()->updateCellResultColor( timeStepIndex, scalarColorMapper, ternaryColorMapper );
}
@ -127,11 +127,11 @@ void RimIntersectionCollection::appendPartsToModel( Rim3dView& view,
cvf::ModelBasicList* model,
cvf::Transform* scaleTransform )
{
if ( !isActive ) return;
if ( !isActive() ) return;
for ( RimIntersection* cs : m_intersections )
{
if ( cs->isActive )
if ( cs->isActive() )
{
cs->intersectionPartMgr()->appendNativeCrossSectionFacesToModel( model, scaleTransform );
cs->intersectionPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
@ -141,7 +141,7 @@ void RimIntersectionCollection::appendPartsToModel( Rim3dView& view,
for ( RimIntersectionBox* cs : m_intersectionBoxes )
{
if ( cs->isActive )
if ( cs->isActive() )
{
cs->intersectionBoxPartMgr()->appendNativeCrossSectionFacesToModel( model, scaleTransform );
cs->intersectionBoxPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
@ -302,11 +302,11 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
//--------------------------------------------------------------------------------------------------
bool RimIntersectionCollection::hasActiveIntersectionForSimulationWell( const RimSimWellInView* simWell ) const
{
if ( !isActive ) return false;
if ( !isActive() ) return false;
for ( RimIntersection* cs : m_intersections )
{
if ( cs->isActive && cs->type() == RimIntersection::CS_SIMULATION_WELL && cs->simulationWell() == simWell )
if ( cs->isActive() && cs->type() == RimIntersection::CS_SIMULATION_WELL && cs->simulationWell() == simWell )
{
return true;
}