mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added mesh color as preference, and resetting of preferences before doing regression tests
p4#: 21263
This commit is contained in:
parent
9b0378f8e0
commit
337e0c3226
@ -1278,6 +1278,7 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
|
||||
imageCompareReporter.generateHTMLReport(testDir.filePath(RegTestNames::reportFileName).toStdString());
|
||||
|
||||
// Generate diff images
|
||||
this->preferences()->resetToDefaults();
|
||||
|
||||
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
|
||||
{
|
||||
|
@ -38,6 +38,9 @@ RiaPreferences::RiaPreferences(void)
|
||||
octaveExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", "");
|
||||
CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", cvf::Color3f(0.92f, 0.92f, 0.92f), "Mesh color", "", "", "");
|
||||
CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", cvf::Color3f(0.08f, 0.08f, 0.08f), "Mesh color along faults", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Z scale factor", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
|
||||
@ -88,9 +91,26 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings");
|
||||
defaultSettingsGroup->add(&defaultScaleFactorZ);
|
||||
defaultSettingsGroup->add(&defaultGridLines);
|
||||
defaultSettingsGroup->add(&defaultGridLineColors);
|
||||
defaultSettingsGroup->add(&defaultFaultGridLineColors);
|
||||
|
||||
|
||||
caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Compute when loading new case");
|
||||
autoComputeGroup->add(&autocomputeSOIL);
|
||||
autoComputeGroup->add(&autocomputeDepthRelatedProperties);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferences::resetToDefaults()
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
this->fields(fields);
|
||||
|
||||
for (size_t i = 0; i < fields.size(); ++i)
|
||||
{
|
||||
fields[i]->resetToDefaultValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ public:
|
||||
RiaPreferences(void);
|
||||
virtual ~RiaPreferences(void);
|
||||
|
||||
void resetToDefaults();
|
||||
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
|
||||
|
||||
@ -38,6 +40,8 @@ public: // Pdm Fields
|
||||
|
||||
caf::PdmField<int> defaultScaleFactorZ;
|
||||
caf::PdmField<bool> defaultGridLines;
|
||||
caf::PdmField<cvf::Color3f> defaultGridLineColors;
|
||||
caf::PdmField<cvf::Color3f> defaultFaultGridLineColors;
|
||||
|
||||
caf::PdmField<bool> useShaders;
|
||||
caf::PdmField<bool> showHud;
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "RigGridScalarDataAccess.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -144,10 +146,12 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
|
||||
part->setTransform(m_scaleTransform.p());
|
||||
part->updateBoundingBox();
|
||||
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
if (faultGeometry)
|
||||
{
|
||||
caf::MeshEffectGenerator effGen(cvf::Color3f::BLACK);
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultFaultGridLineColors());
|
||||
eff = effGen.generateEffect();
|
||||
|
||||
part->setEnableMask(meshFaultBit);
|
||||
@ -156,7 +160,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::MeshEffectGenerator effGen(cvf::Color3f::WHITE);
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
|
||||
eff = effGen.generateEffect();
|
||||
|
||||
// Set priority to make sure fault lines are rendered first
|
||||
@ -205,6 +209,23 @@ void RivGridPartMgr::updateCellColor(cvf::Color4f color)
|
||||
|
||||
m_opacityLevel = color.a();
|
||||
m_defaultColor = color.toColor3f();
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
if (m_faultFaces.notNull())
|
||||
{
|
||||
caf::MeshEffectGenerator faultEffGen(prefs->defaultFaultGridLineColors());
|
||||
eff = faultEffGen.generateEffect();
|
||||
m_faultGridLines->setEffect(eff.p());
|
||||
}
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
|
||||
eff = effGen.generateEffect();
|
||||
m_surfaceGridLines->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
PdmFieldHandle() : m_isIOReadable(true), m_isIOWritable(true) { m_ownerObject = NULL; m_keyword = "UNDEFINED"; }
|
||||
virtual ~PdmFieldHandle() { }
|
||||
|
||||
virtual void resetToDefaultValue() { };
|
||||
|
||||
virtual void readFieldData(QXmlStreamReader& xmlStream) = 0;
|
||||
virtual void writeFieldData(QXmlStreamWriter& xmlStream) = 0;
|
||||
|
||||
@ -119,6 +121,7 @@ public:
|
||||
|
||||
const DataType& defaultValue() const { return m_defaultFieldValue; }
|
||||
void setDefaultValue(const DataType& val) { m_defaultFieldValue = val; }
|
||||
virtual void resetToDefaultValue() { m_fieldValue = m_defaultFieldValue; }
|
||||
|
||||
// Gui generalized interface
|
||||
virtual QVariant uiValue() const;
|
||||
|
Loading…
Reference in New Issue
Block a user