diff --git a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp index 92fea1a2f1..b2f824618b 100644 --- a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -89,10 +89,19 @@ void RivWellFracturePartMgr::updatePartGeometry(caf::DisplayCoordTransform* disp m_part = new cvf::Part; m_part->setDrawable(geo.p()); - caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)), caf::PO_1); - cvf::ref eff = surfaceGen.generateCachedEffect(); + cvf::Color4f fractureColor = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)); + RimEclipseView* activeView = dynamic_cast(RiaApplication::instance()->activeReservoirView()); + if (activeView) + { + fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor(), activeView->stimPlanColors->opacityLevel()); + } + + caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1); + cvf::ref eff = surfaceGen.generateCachedEffect(); m_part->setEffect(eff.p()); + + m_part->setPriority(RivPartPriority::PartType::Transparent); } } @@ -201,8 +210,7 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor } else { - cvf::Color4f fractureColor = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)); - fractureColor.a() = opacityLevel; + cvf::Color4f fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor(), opacityLevel); caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1); cvf::ref eff = surfaceGen.generateCachedEffect(); diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp index 01d4695e9a..4d110318dd 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp @@ -42,13 +42,15 @@ RimStimPlanColors::RimStimPlanColors() { CAF_PDM_InitObject("StimPlan Colors", ":/FractureSymbol16x16.png", "", ""); - CAF_PDM_InitField(&m_resultNameAndUnit, "ResultName", QString(""), "Result Variable", "", "", ""); + CAF_PDM_InitField(&m_resultNameAndUnit, "ResultName", QString(""), "StimPlan Result Variable", "", "", ""); CAF_PDM_InitField(&m_opacityLevel, "opacityLevel", 0.2f, "Transparency", "", "", ""); + CAF_PDM_InitField(&m_defaultColor, "DefaultColor", cvf::Color3f(cvf::Color3::BROWN), "Default Color", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", ""); m_legendConfigurations.uiCapability()->setUiTreeHidden(true); - m_name = "StimPlan Colors"; + m_name = "Fracture Colors"; + m_name.uiCapability()->setUiReadOnly(true); } //-------------------------------------------------------------------------------------------------- @@ -203,6 +205,14 @@ float RimStimPlanColors::opacityLevel() const return m_opacityLevel(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RimStimPlanColors::defaultColor() const +{ + return m_defaultColor(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -297,6 +307,8 @@ void RimStimPlanColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin { uiOrdering.add(&m_resultNameAndUnit); uiOrdering.add(&m_opacityLevel); + uiOrdering.add(&m_defaultColor); + uiOrdering.setForgetRemainingFields(true); } diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanColors.h b/ApplicationCode/ProjectDataModel/RimStimPlanColors.h index f7f991b623..6bd150da66 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanColors.h +++ b/ApplicationCode/ProjectDataModel/RimStimPlanColors.h @@ -25,10 +25,14 @@ #include "cafPdmField.h" #include "cafPdmChildArrayField.h" +// Include to make Pdm work for cvf::Color +#include "cafPdmFieldCvfColor.h" + namespace caf { class PdmOptionItemInfo; } + class RimLegendConfig; class RimFractureTemplateCollection; @@ -48,7 +52,8 @@ public: QString resultName() const; QString unit() const; float opacityLevel() const; - + cvf::Color3f defaultColor() const; + void loadDataAndUpdate(); void updateLegendData(); @@ -68,6 +73,7 @@ private: private: caf::PdmField m_opacityLevel; + caf::PdmField m_defaultColor; caf::PdmField m_resultNameAndUnit; caf::PdmChildArrayField m_legendConfigurations; };