#1252 Add and use transparent color for both ellipse and stim plan objects

This commit is contained in:
Magne Sjaastad 2017-02-23 10:15:56 +01:00
parent 5ccde99cb3
commit 7f75f7e509
3 changed files with 33 additions and 7 deletions

View File

@ -89,10 +89,19 @@ void RivWellFracturePartMgr::updatePartGeometry(caf::DisplayCoordTransform* disp
m_part = new cvf::Part; m_part = new cvf::Part;
m_part->setDrawable(geo.p()); m_part->setDrawable(geo.p());
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)), caf::PO_1); cvf::Color4f fractureColor = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN));
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView)
{
fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor(), activeView->stimPlanColors->opacityLevel());
}
caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
m_part->setEffect(eff.p()); m_part->setEffect(eff.p());
m_part->setPriority(RivPartPriority::PartType::Transparent);
} }
} }
@ -201,8 +210,7 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
} }
else else
{ {
cvf::Color4f fractureColor = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)); cvf::Color4f fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor(), opacityLevel);
fractureColor.a() = opacityLevel;
caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1); caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect(); cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();

View File

@ -42,13 +42,15 @@ RimStimPlanColors::RimStimPlanColors()
{ {
CAF_PDM_InitObject("StimPlan Colors", ":/FractureSymbol16x16.png", "", ""); 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_opacityLevel, "opacityLevel", 0.2f, "Transparency", "", "", "");
CAF_PDM_InitField(&m_defaultColor, "DefaultColor", cvf::Color3f(cvf::Color3::BROWN), "Default Color", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
m_legendConfigurations.uiCapability()->setUiTreeHidden(true); 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(); 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_resultNameAndUnit);
uiOrdering.add(&m_opacityLevel); uiOrdering.add(&m_opacityLevel);
uiOrdering.add(&m_defaultColor);
uiOrdering.setForgetRemainingFields(true); uiOrdering.setForgetRemainingFields(true);
} }

View File

@ -25,10 +25,14 @@
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmChildArrayField.h" #include "cafPdmChildArrayField.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
namespace caf { namespace caf {
class PdmOptionItemInfo; class PdmOptionItemInfo;
} }
class RimLegendConfig; class RimLegendConfig;
class RimFractureTemplateCollection; class RimFractureTemplateCollection;
@ -48,7 +52,8 @@ public:
QString resultName() const; QString resultName() const;
QString unit() const; QString unit() const;
float opacityLevel() const; float opacityLevel() const;
cvf::Color3f defaultColor() const;
void loadDataAndUpdate(); void loadDataAndUpdate();
void updateLegendData(); void updateLegendData();
@ -68,6 +73,7 @@ private:
private: private:
caf::PdmField<float> m_opacityLevel; caf::PdmField<float> m_opacityLevel;
caf::PdmField<cvf::Color3f> m_defaultColor;
caf::PdmField<QString> m_resultNameAndUnit; caf::PdmField<QString> m_resultNameAndUnit;
caf::PdmChildArrayField<RimLegendConfig*> m_legendConfigurations; caf::PdmChildArrayField<RimLegendConfig*> m_legendConfigurations;
}; };