3D Well Log Curves (#2669): Implement control of single color.

* Set a cycled default whenever a curve is added to a collection.
This commit is contained in:
Gaute Lindkvist 2018-04-17 08:38:13 +02:00
parent 501e80b1ad
commit 1180c199b4
5 changed files with 28 additions and 14 deletions

View File

@ -114,7 +114,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
continue;
}
caf::MeshEffectGenerator meshEffectGen(curveColor(colorIndex));
caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color());
meshEffectGen.setLineWidth(2.0f);
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
@ -193,14 +193,6 @@ double Riv3dWellLogPlanePartMgr::planeWidth() const
return cellSize * 1.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f Riv3dWellLogPlanePartMgr::curveColor(size_t index)
{
return RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(index);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -74,8 +74,6 @@ private:
double wellPathCenterToPlotStartOffset(Rim3dWellLogCurveCollection::PlanePosition planePosition) const;
double planeWidth() const;
cvf::Color3f curveColor(size_t index);
private:
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
cvf::ref<Riv3dWellLogGridGeometryGenerator> m_3dWellLogGridGeometryGenerator;

View File

@ -77,6 +77,8 @@ void Rim3dWellLogCurveCollection::add3dWellLogCurve(Rim3dWellLogCurve* curve)
{
if (curve)
{
size_t index = m_3dWellLogCurves.size();
curve->setColor(RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(index));
m_3dWellLogCurves.push_back(curve);
}
}

View File

@ -72,7 +72,7 @@ Rim3dWellLogCurve::Rim3dWellLogCurve()
CAF_PDM_InitFieldNoDefault(&m_drawPlane, "DrawPlane", "Draw Plane", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_drawStyle, "DrawStyle", "Draw Style", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_coloringStyle, "ColoringStyle", "Coloring Style", "", "", "");
CAF_PDM_InitField(&m_color, "CurveColor", cvf::Color3f(0.0f, 0.0f, 0.0f), "Curve Color", "", "", "");
CAF_PDM_InitField(&m_name, "Name", QString("3D Well Log Curve"), "3d Well Log Curve", "", "", "");
m_name.uiCapability()->setUiHidden(true);
}
@ -118,6 +118,14 @@ Rim3dWellLogCurve::ColoringStyle Rim3dWellLogCurve::coloringStyle() const
return m_coloringStyle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f Rim3dWellLogCurve::color() const
{
return m_color;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -126,6 +134,14 @@ bool Rim3dWellLogCurve::isShowingCurve() const
return m_showCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::setColor(const cvf::Color3f& color)
{
m_color = color;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -168,6 +184,6 @@ void Rim3dWellLogCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
curveAppearanceGroup->add(&m_drawPlane);
curveAppearanceGroup->add(&m_drawStyle);
curveAppearanceGroup->add(&m_coloringStyle);
curveAppearanceGroup->add(&m_color);
}

View File

@ -22,6 +22,8 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmFieldCvfColor.h"
//==================================================================================================
///
///
@ -63,10 +65,12 @@ public:
DrawPlane drawPlane() const;
DrawStyle drawStyle() const;
ColoringStyle coloringStyle() const;
cvf::Color3f color() const;
bool isShowingCurve() const;
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const = 0;
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const = 0;
void setColor(const cvf::Color3f& color);
protected:
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
@ -78,6 +82,8 @@ protected:
caf::PdmField<caf::AppEnum<DrawPlane>> m_drawPlane;
caf::PdmField<caf::AppEnum<DrawStyle>> m_drawStyle;
caf::PdmField<caf::AppEnum<ColoringStyle>> m_coloringStyle;
caf::PdmField<cvf::Color3f> m_color;
private:
caf::PdmField<bool> m_showCurve;