(#396) Setting default curve color on creation

This commit is contained in:
Pål Hagen
2015-09-03 10:55:54 +02:00
parent bcab7f2248
commit 9a6221b7e8
4 changed files with 59 additions and 7 deletions

View File

@@ -43,6 +43,7 @@
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurve, "WellLogEclipseCurve");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -68,7 +69,6 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
m_geomResultDefinition = new RimGeoMechResultDefinition;
CAF_PDM_InitField(&m_timeStep, "CurveTimeStep", 0,"Time Step", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@@ -140,6 +140,7 @@ void RimWellLogExtractionCurve::updatePlotData()
if (isNeedingUpdate)
{
m_plotCurve->setSamples(values.data(), depthValues.data(), (int)depthValues.size());
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
RimWellLogPlot* wellLogPlot;
firstAnchestorOrThisOfType(wellLogPlot);

View File

@@ -36,6 +36,8 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
m_showCurve.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_userName, "CurveDescription", "Name", "", "", "");
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
m_plotCurve = new QwtPlotCurve;
m_plotCurve->setXAxis(QwtPlot::xTop);
m_plotCurve->setYAxis(QwtPlot::yLeft);
@@ -108,6 +110,7 @@ void RimWellLogPlotCurve::updatePlotData()
depthValues.push_back(1000);
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
RimWellLogPlot* wellLogPlot;
firstAnchestorOrThisOfType(wellLogPlot);
@@ -156,3 +159,11 @@ bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth)
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::setColor(const cvf::Color3f& color)
{
m_curveColor = color;
}

View File

@@ -21,6 +21,7 @@
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfColor.h"
#include <vector>
@@ -28,7 +29,6 @@ class RiuWellLogTracePlot;
class QwtPlotCurve;
class QString;
//==================================================================================================
///
///
@@ -42,7 +42,9 @@ public:
void setDescription(QString description) {m_userName = description;}
void setPlot(RiuWellLogTracePlot* plot);
void setColor(const cvf::Color3f& color);
bool depthRange(double* minimumDepth, double* maximumDepth);
virtual void updatePlotData();
protected:
@@ -53,9 +55,9 @@ protected:
virtual caf::PdmFieldHandle* userDescriptionField();
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_userName;
// caf::PdmField<QColor> m_curveColor;
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_userName;
caf::PdmField<cvf::Color3f> m_curveColor;
// caf::PdmField<Linestyle> m_lineStyle;
// caf::PdmField<int> m_lineWidth;