#3565 Cell Edge : Move field private and whitespace fixes

This commit is contained in:
Magne Sjaastad 2018-10-25 22:15:23 +02:00
parent fb57cf048d
commit fbaa49b72c
3 changed files with 55 additions and 50 deletions

View File

@ -55,7 +55,7 @@ RimCellEdgeColors::RimCellEdgeColors()
{ {
CAF_PDM_InitObject("Cell Edge Result", ":/EdgeResult_1.png", "", ""); CAF_PDM_InitObject("Cell Edge Result", ":/EdgeResult_1.png", "", "");
CAF_PDM_InitField(&enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results", "", "", ""); CAF_PDM_InitField(&m_enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_propertyType, "propertyType", "Property Type", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_propertyType, "propertyType", "Property Type", "", "", "");
@ -98,7 +98,7 @@ void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::loadResult() void RimCellEdgeColors::loadResult()
{ {
if (!enableCellEdgeColors) return; if (!m_enableCellEdgeColors) return;
if (!m_reservoirView->currentGridCellResults()) return; if (!m_reservoirView->currentGridCellResults()) return;
if (isUsingSingleVariable()) if (isUsingSingleVariable())
@ -396,7 +396,7 @@ void RimCellEdgeColors::resetResultIndices()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimCellEdgeColors::hasResult() const bool RimCellEdgeColors::hasResult() const
{ {
if (!enableCellEdgeColors()) return false; if (!m_enableCellEdgeColors()) return false;
if (isUsingSingleVariable() && m_singleVarEdgeResultColors->isFlowDiagOrInjectionFlooding()) if (isUsingSingleVariable() && m_singleVarEdgeResultColors->isFlowDiagOrInjectionFlooding())
{ {
@ -568,12 +568,20 @@ QString RimCellEdgeColors::resultVariableUiShortName() const
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::setActive(bool active)
{
m_enableCellEdgeColors = active;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCellEdgeColors::objectToggleField() caf::PdmFieldHandle* RimCellEdgeColors::objectToggleField()
{ {
return &enableCellEdgeColors; return &m_enableCellEdgeColors;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -67,65 +67,62 @@ public:
typedef caf::AppEnum<RimCellEdgeColors::EdgeFaceType> EdgeFaceEnum; typedef caf::AppEnum<RimCellEdgeColors::EdgeFaceType> EdgeFaceEnum;
void setReservoirView(RimEclipseView* ownerReservoirView); void setReservoirView(RimEclipseView* ownerReservoirView);
void setEclipseCase(RimEclipseCase* eclipseCase); void setEclipseCase(RimEclipseCase* eclipseCase);
void setResultVariable(const QString& variableName); void setResultVariable(const QString& variableName);
QString resultVariable() const; QString resultVariable() const;
QString resultVariableUiName() const; QString resultVariableUiName() const;
QString resultVariableUiShortName() const; QString resultVariableUiShortName() const;
caf::PdmField<bool> enableCellEdgeColors; void setActive(bool active);
double ignoredScalarValue() { return m_ignoredResultScalar; } double ignoredScalarValue() { return m_ignoredResultScalar; }
void gridScalarIndices(size_t resultIndices[6]); void gridScalarIndices(size_t resultIndices[6]);
void cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaData); void cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaData);
void loadResult(); void loadResult();
bool hasResult() const; bool hasResult() const;
bool hasCategoryResult() const; bool hasCategoryResult() const;
bool isUsingSingleVariable() const; bool isUsingSingleVariable() const;
RimEclipseCellColors* singleVarEdgeResultColors(); RimEclipseCellColors* singleVarEdgeResultColors();
RimRegularLegendConfig* legendConfig(); RimRegularLegendConfig* legendConfig();
PropertyType propertyType() const; PropertyType propertyType() const;
void minMaxCellEdgeValues(double& min, double& max); void minMaxCellEdgeValues(double& min, double& max);
void posNegClosestToZero(double& pos, double& neg); void posNegClosestToZero(double& pos, double& neg);
void updateUiFieldsFromActiveResult(); void updateUiFieldsFromActiveResult();
protected: protected:
void initAfterRead() override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly ) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
void initAfterRead() override; QStringList findResultVariableNames();
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly ) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
QStringList findResultVariableNames();
private: private:
void resetResultIndices(); void resetResultIndices();
void updateIgnoredScalarValue(); void updateIgnoredScalarValue();
void gridScalarResultNames(std::vector<QString>* resultNames); void gridScalarResultNames(std::vector<QString>* resultNames);
caf::PdmFieldHandle* objectToggleField() override; caf::PdmFieldHandle* objectToggleField() override;
caf::PdmField<QString> m_resultVariable; caf::PdmField<bool> m_enableCellEdgeColors;
caf::PdmField<bool> useXVariable; caf::PdmField<QString> m_resultVariable;
caf::PdmField<bool> useYVariable; caf::PdmField<bool> useXVariable;
caf::PdmField<bool> useZVariable; caf::PdmField<bool> useYVariable;
caf::PdmField<bool> useZVariable;
std::array<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs; std::array<std::pair<QString, size_t>, 6> m_resultNameToIndexPairs;
caf::PdmPointer<RimEclipseView> m_reservoirView; caf::PdmPointer<RimEclipseView> m_reservoirView;
double m_ignoredResultScalar; double m_ignoredResultScalar;
caf::PdmField<caf::AppEnum< PropertyType > > m_propertyType;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
caf::PdmChildField<RimEclipseCellColors*> m_singleVarEdgeResultColors;
caf::PdmField<caf::AppEnum<PropertyType>> m_propertyType;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
caf::PdmChildField<RimEclipseCellColors*> m_singleVarEdgeResultColors;
}; };

View File

@ -272,7 +272,7 @@ RimEclipseView* RimEclipseCase::createAndAddReservoirView()
rimEclipseView->hasUserRequestedAnimation = true; rimEclipseView->hasUserRequestedAnimation = true;
rimEclipseView->cellEdgeResult()->setResultVariable("MULT"); rimEclipseView->cellEdgeResult()->setResultVariable("MULT");
rimEclipseView->cellEdgeResult()->enableCellEdgeColors = false; rimEclipseView->cellEdgeResult()->setActive(false);
rimEclipseView->fractureColors()->setDefaultResultName(); rimEclipseView->fractureColors()->setDefaultResultName();
} }
@ -356,7 +356,7 @@ Rim2dEclipseView* RimEclipseCase::create2dContourMap()
contourMap->hasUserRequestedAnimation = true; contourMap->hasUserRequestedAnimation = true;
contourMap->cellEdgeResult()->setResultVariable("MULT"); contourMap->cellEdgeResult()->setResultVariable("MULT");
contourMap->cellEdgeResult()->enableCellEdgeColors = false; contourMap->cellEdgeResult()->setActive(false);
contourMap->fractureColors()->setDefaultResultName(); contourMap->fractureColors()->setDefaultResultName();
} }