#1138 - pre-proto - Using legend config for controlling colors of stimPlan fracture

This commit is contained in:
astridkbjorke
2017-02-16 09:15:23 +01:00
parent 3ae816a9aa
commit 8a603c7f73
3 changed files with 36 additions and 20 deletions

View File

@@ -32,6 +32,7 @@
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cvfScalarMapperContinuousLinear.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimLegendConfig.h"
//--------------------------------------------------------------------------------------------------
@@ -133,7 +134,7 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
dataToPlot = stimPlanFracTemplate->getWidthsAtTimeStep(timeStepIndex);
}
if (dataToPlot.empty()) return;
if (dataToPlot.empty()) return; //TODO: Set all values to undefined if no data available...
const std::vector<cvf::Vec3f>& nodeCoords = m_rimFracture->nodeCoords();
const std::vector<cvf::uint>& triangleIndices = m_rimFracture->triangleIndices();
@@ -151,19 +152,20 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
m_part = new cvf::Part;
m_part->setDrawable(geo.p());
cvf::ref<cvf::ScalarMapperContinuousLinear> scalarMapper = new cvf::ScalarMapperContinuousLinear;
{
cvf::Color3ubArray legendColors;
legendColors.resize(4);
legendColors[0] = cvf::Color3::GRAY;
legendColors[1] = cvf::Color3::GREEN;
legendColors[2] = cvf::Color3::BLUE;
legendColors[3] = cvf::Color3::RED;
scalarMapper->setColors(legendColors);
scalarMapper->setRange(0.0, 4.0);
scalarMapper->setLevelCount(4, true);
}
RimLegendConfig* legend = m_rimFracture->activeLegend();
cvf::ScalarMapper* scalarMapper = legend->scalarMapper();
// cvf::ref<cvf::ScalarMapperContinuousLinear> scalarMapper = new cvf::ScalarMapperContinuousLinear;
// {
// cvf::Color3ubArray legendColors;
// legendColors.resize(4);
// legendColors[0] = cvf::Color3::GRAY;
// legendColors[1] = cvf::Color3::GREEN;
// legendColors[2] = cvf::Color3::BLUE;
// legendColors[3] = cvf::Color3::RED;
// scalarMapper->setColors(legendColors);
// scalarMapper->setRange(0.0, 4.0);
// scalarMapper->setLevelCount(4, true);
// }
//double scalarValue = i % 4;
@@ -186,8 +188,8 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
geo->setTextureCoordArray(textureCoords.p());
caf::ScalarMapperEffectGenerator nncEffgen(scalarMapper.p(), caf::PO_NEG_LARGE);
cvf::ref<cvf::Effect> eff = nncEffgen.generateUnCachedEffect();
caf::ScalarMapperEffectGenerator scalarMapperEffectGenerator(scalarMapper, caf::PO_NEG_LARGE);
cvf::ref<cvf::Effect> eff = scalarMapperEffectGenerator.generateUnCachedEffect();
m_part->setEffect(eff.p());
}
@@ -217,6 +219,8 @@ std::vector<double> RivWellFracturePartMgr::mirrorDataAtSingleDepth(std::vector<
//--------------------------------------------------------------------------------------------------
void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
{
clearGeometryCache();
if (m_part.isNull())
{
if (m_rimFracture->attachedFractureDefinition())

View File

@@ -705,10 +705,9 @@ void RimFracture::defineEditorAttribute(const caf::PdmFieldHandle* field, QStrin
//--------------------------------------------------------------------------------------------------
void RimFracture::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
// TODO: Based on selected result, show correct legend
if (RimFracture::CONDUCTIVITY) uiTreeOrdering.add(m_legendConfigConductivity);
if (RimFracture::PERMEABILITY) uiTreeOrdering.add(m_legendConfigPermeability);
if (RimFracture::WIDTH) uiTreeOrdering.add(m_legendConfigWidth);
if (stimPlanParameterToPlot == RimFracture::CONDUCTIVITY) uiTreeOrdering.add(m_legendConfigConductivity);
else if (stimPlanParameterToPlot == RimFracture::PERMEABILITY) uiTreeOrdering.add(m_legendConfigPermeability);
else if (stimPlanParameterToPlot == RimFracture::WIDTH) uiTreeOrdering.add(m_legendConfigWidth);
uiTreeOrdering.setForgetRemainingFields(true);
}
@@ -794,6 +793,18 @@ RivWellFracturePartMgr* RimFracture::fracturePartManager()
return m_rivFracture.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimLegendConfig* RimFracture::activeLegend()
{
if (stimPlanParameterToPlot == RimFracture::CONDUCTIVITY) return m_legendConfigConductivity;
else if (stimPlanParameterToPlot == RimFracture::PERMEABILITY) return m_legendConfigPermeability;
else if (stimPlanParameterToPlot == RimFracture::WIDTH) return m_legendConfigWidth;
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -80,6 +80,7 @@ public:
RimFractureTemplate* attachedFractureDefinition() const;
RivWellFracturePartMgr* fracturePartManager();
RimLegendConfig* activeLegend();
bool hasValidGeometry() const;
void computeGeometry();