#4352 Fractures : Delegate isEnabled to leaf classes

This commit is contained in:
Magne Sjaastad 2019-04-25 07:25:52 +02:00
parent a5a70dd83c
commit 319050b992
6 changed files with 30 additions and 16 deletions

View File

@ -42,7 +42,6 @@
#include "RimReservoirCellResultsStorage.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimWellPathFractureCollection.h"
#include "RivWellFracturePartMgr.h"
@ -322,16 +321,6 @@ void RimFracture::clearCachedNonDarcyProperties()
m_cachedFractureProperties = NonDarcyData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFracture::isEnabled() const
{
RimWellPathFractureCollection* fractureCollection = nullptr;
this->firstAncestorOrThisOfTypeAsserted(fractureCollection);
return fractureCollection->isChecked() && isChecked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -130,7 +130,6 @@ public:
friend class RimFractureTemplate;
// RimWellPathCompletionsInterface overrides.
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;

View File

@ -144,6 +144,14 @@ std::vector<cvf::Vec3d> RimSimWellFracture::perforationLengthCenterLineCoords()
return coords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSimWellFracture::isEnabled() const
{
return isChecked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -56,6 +56,8 @@ public:
std::vector<cvf::Vec3d> perforationLengthCenterLineCoords() const override;
bool isEnabled() const override; // RimWellPathCompletionsInterface override
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;

View File

@ -24,6 +24,7 @@
#include "RimEllipseFractureTemplate.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathFractureCollection.h"
#include "cafPdmUiDoubleSliderEditor.h"
@ -80,7 +81,7 @@ void RimWellPathFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj);
if (proj) proj->reloadCompletionTypeResultsInAllViews();
}
}
}
//--------------------------------------------------------------------------------------------------
@ -186,6 +187,19 @@ bool RimWellPathFracture::compareByWellPathNameAndMD(const RimWellPathFracture*
return lhs->fractureMD() < rhs->fractureMD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathFracture::isEnabled() const
{
RimWellPathFractureCollection* fractureCollection = nullptr;
this->firstAncestorOrThisOfType(fractureCollection);
if (fractureCollection)
{
return fractureCollection->isChecked() && isChecked();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -220,7 +234,7 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
{
uiOrdering.add(nameField(), caf::PdmUiOrdering::LayoutOptions(true, 3, 1));
uiOrdering.add(&m_fractureTemplate, {true, 2, 1});
uiOrdering.add(&m_editFractureTemplate, { false, 1, 0 });
uiOrdering.add(&m_editFractureTemplate, {false, 1, 0});
}
else
{
@ -236,8 +250,8 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
else
{
uiOrdering.add(&m_fractureTemplate);
}
}
}
}
}
caf::PdmUiGroup* locationGroup = uiOrdering.addNewGroup("Location / Orientation");

View File

@ -52,6 +52,8 @@ public:
static bool compareByWellPathNameAndMD(const RimWellPathFracture* lhs, const RimWellPathFracture* rhs);
bool isEnabled() const override; // RimWellPathCompletionsInterface override
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;