mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
parent
c903e87dfd
commit
3e8873c870
@ -51,8 +51,8 @@ RimCellEdgeColors::RimCellEdgeColors()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", ":/Legend.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_customFaultResultColors, "CustomEdgeResult", "Custom Edge Result", ":/CellResult.png", "", "");
|
||||
m_customFaultResultColors = new RimEclipseCellColors();
|
||||
CAF_PDM_InitFieldNoDefault(&m_singleVarEdgeResultColors, "CustomEdgeResult", "Custom Edge Result", ":/CellResult.png", "", "");
|
||||
m_singleVarEdgeResultColors = new RimEclipseCellColors();
|
||||
|
||||
m_resultVariable.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
@ -68,7 +68,7 @@ RimCellEdgeColors::RimCellEdgeColors()
|
||||
RimCellEdgeColors::~RimCellEdgeColors()
|
||||
{
|
||||
delete legendConfig();
|
||||
delete m_customFaultResultColors;
|
||||
delete m_singleVarEdgeResultColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -78,7 +78,7 @@ void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView)
|
||||
{
|
||||
m_reservoirView = ownerReservoirView;
|
||||
this->legendConfig()->setReservoirView(ownerReservoirView);
|
||||
m_customFaultResultColors->setReservoirView(ownerReservoirView);
|
||||
m_singleVarEdgeResultColors->setReservoirView(ownerReservoirView);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -88,13 +88,14 @@ void RimCellEdgeColors::loadResult()
|
||||
{
|
||||
CVF_ASSERT(m_reservoirView && m_reservoirView->currentGridCellResults());
|
||||
|
||||
if (m_resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(m_customFaultResultColors->resultType(), m_customFaultResultColors->resultVariable());
|
||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(m_singleVarEdgeResultColors->resultType(),
|
||||
m_singleVarEdgeResultColors->resultVariable());
|
||||
|
||||
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||
{
|
||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_customFaultResultColors->resultVariable(), resultindex);
|
||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -135,7 +136,7 @@ void RimCellEdgeColors::loadResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::initAfterRead()
|
||||
{
|
||||
m_customFaultResultColors->initAfterRead();
|
||||
m_singleVarEdgeResultColors->initAfterRead();
|
||||
|
||||
updateFieldVisibility();
|
||||
}
|
||||
@ -234,7 +235,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
|
||||
|
||||
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), ""));
|
||||
|
||||
optionList.push_back(caf::PdmOptionItemInfo(RimCellEdgeColors::customEdgeResultUiText(), RimCellEdgeColors::customEdgeResultUiText()));
|
||||
optionList.push_back(caf::PdmOptionItemInfo(RimCellEdgeColors::singleVarEdgeResultUiText(), RimCellEdgeColors::singleVarEdgeResultUiText()));
|
||||
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
@ -252,12 +253,12 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
{
|
||||
uiOrdering.add(&m_resultVariable);
|
||||
|
||||
if (m_resultVariable().compare(RimCellEdgeColors::customEdgeResultUiText()) == 0)
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Custom Edge Result");
|
||||
group1->add(&(m_customFaultResultColors->m_resultTypeUiField));
|
||||
group1->add(&(m_customFaultResultColors->m_porosityModelUiField));
|
||||
group1->add(&(m_customFaultResultColors->m_resultVariableUiField));
|
||||
group1->add(&(m_singleVarEdgeResultColors->m_resultTypeUiField));
|
||||
group1->add(&(m_singleVarEdgeResultColors->m_porosityModelUiField));
|
||||
group1->add(&(m_singleVarEdgeResultColors->m_resultVariableUiField));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -333,6 +334,15 @@ void RimCellEdgeColors::gridScalarResultNames(std::vector<QString>* resultNames)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellEdgeColors::isUsingSingleVariable() const
|
||||
{
|
||||
return (m_resultVariable == singleVarEdgeResultUiText());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -347,9 +357,9 @@ void RimCellEdgeColors::cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaD
|
||||
this->gridScalarResultNames(&resultNames);
|
||||
|
||||
bool isStatic = true;
|
||||
if (m_resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
isStatic = m_customFaultResultColors->resultType() == RimDefines::STATIC_NATIVE;
|
||||
isStatic = m_singleVarEdgeResultColors->resultType() == RimDefines::STATIC_NATIVE;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
@ -368,7 +378,7 @@ void RimCellEdgeColors::cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaD
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::updateFieldVisibility()
|
||||
{
|
||||
m_customFaultResultColors->updateFieldVisibility();
|
||||
m_singleVarEdgeResultColors->updateFieldVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -477,7 +487,7 @@ void RimCellEdgeColors::posNegClosestToZero(double& pos, double& neg)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::setEclipseCase(RimEclipseCase* eclipseCase)
|
||||
{
|
||||
m_customFaultResultColors->setEclipseCase(eclipseCase);
|
||||
m_singleVarEdgeResultColors->setEclipseCase(eclipseCase);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -493,9 +503,9 @@ void RimCellEdgeColors::setResultVariable(const QString& variableName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariable() const
|
||||
{
|
||||
if (m_resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
return m_customFaultResultColors->resultVariable();
|
||||
return m_singleVarEdgeResultColors->resultVariable();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -511,3 +521,19 @@ caf::PdmFieldHandle* RimCellEdgeColors::objectToggleField()
|
||||
return &enableCellEdgeColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellEdgeColors::hasCategoryResult() const
|
||||
{
|
||||
return isUsingSingleVariable() && m_singleVarEdgeResultColors->hasCategoryResult();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCellColors* RimCellEdgeColors::singleVarEdgeResultColors()
|
||||
{
|
||||
return m_singleVarEdgeResultColors;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
|
||||
void loadResult();
|
||||
bool hasResult() const;
|
||||
bool hasCategoryResult() const;
|
||||
RimEclipseCellColors* singleVarEdgeResultColors();
|
||||
|
||||
void minMaxCellEdgeValues(double& min, double& max);
|
||||
void posNegClosestToZero(double& pos, double& neg);
|
||||
@ -97,7 +99,6 @@ private:
|
||||
void updateIgnoredScalarValue();
|
||||
|
||||
void gridScalarResultNames(std::vector<QString>* resultNames);
|
||||
static QString customEdgeResultUiText() { return "Custom Edge Result"; }
|
||||
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
@ -106,10 +107,13 @@ private:
|
||||
caf::PdmField<bool> useYVariable;
|
||||
caf::PdmField<bool> useZVariable;
|
||||
|
||||
caf::FixedArray<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
double m_ignoredResultScalar;
|
||||
caf::FixedArray<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
double m_ignoredResultScalar;
|
||||
|
||||
bool isUsingSingleVariable() const;
|
||||
static QString singleVarEdgeResultUiText() { return "Custom Edge Result"; }
|
||||
caf::PdmChildField<RimEclipseCellColors*> m_singleVarEdgeResultColors;
|
||||
|
||||
caf::PdmChildField<RimEclipseCellColors*> m_customFaultResultColors;
|
||||
};
|
||||
|
||||
|
@ -944,6 +944,23 @@ void RimEclipseView::updateLegends()
|
||||
this->cellEdgeResult()->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
|
||||
this->cellEdgeResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
||||
|
||||
if (this->cellEdgeResult()->hasCategoryResult())
|
||||
{
|
||||
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
|
||||
{
|
||||
cellEdgeResult()->legendConfig()->setCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()),
|
||||
results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex(), 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector =
|
||||
eclipseCase->activeFormationNames()->formationNames();
|
||||
std::set<int> nameIndices;
|
||||
for(int i = 0; i < fnVector.size(); ++i) nameIndices.insert(i);
|
||||
cellEdgeResult()->legendConfig()->setCategories(nameIndices, nameIndices);
|
||||
}
|
||||
}
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig->legend());
|
||||
this->cellEdgeResult()->legendConfig->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable()));
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
|
||||
@ -763,9 +764,12 @@ QList<caf::PdmOptionItemInfo> RimLegendConfig::calculateValueOptions(const caf::
|
||||
this->firstAnchestorOrThisOfType(eclCellColors);
|
||||
RimGeoMechCellColors* gmCellColors = nullptr;
|
||||
this->firstAnchestorOrThisOfType(gmCellColors);
|
||||
RimCellEdgeColors* eclCellEdgColors = nullptr;
|
||||
this->firstAnchestorOrThisOfType(eclCellEdgColors);
|
||||
|
||||
if ( ( eclCellColors && eclCellColors->hasCategoryResult())
|
||||
|| ( gmCellColors && gmCellColors->hasCategoryResult()) )
|
||||
if ( ( eclCellColors && eclCellColors->hasCategoryResult())
|
||||
|| ( gmCellColors && gmCellColors->hasCategoryResult())
|
||||
|| ( eclCellEdgColors && eclCellEdgColors->hasCategoryResult()) )
|
||||
{
|
||||
isCategoryResult = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user