#780 A prototype of linetype pr case color pr var mode

This commit is contained in:
Jacob Støren 2016-06-21 17:29:23 +02:00
parent f581c172f6
commit 268d8dda68
3 changed files with 65 additions and 2 deletions

View File

@ -375,5 +375,12 @@ void RimPlotCurve::loadDataAndUpdate()
this->onLoadDataAndUpdate(); this->onLoadDataAndUpdate();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setLineStyle(LineStyleEnum lineStyle)
{
m_lineStyle = lineStyle;
}

View File

@ -66,6 +66,7 @@ public:
QwtPlotCurve* qwtPlotCurve() const; QwtPlotCurve* qwtPlotCurve() const;
void setColor(const cvf::Color3f& color); void setColor(const cvf::Color3f& color);
void setLineStyle(LineStyleEnum lineStyle);
bool isCurveVisible() const; bool isCurveVisible() const;
QString curveName() const { return m_curveName; } QString curveName() const { return m_curveName; }

View File

@ -229,6 +229,37 @@ void RimSummaryCurveFilter::detachQwtCurves()
} }
} }
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
static const int RI_LOGPLOT_CURVECOLORS[] =
{
Qt::black,
Qt::darkBlue,
Qt::darkRed,
Qt::darkGreen,
Qt::darkYellow,
Qt::darkMagenta,
Qt::darkCyan,
Qt::darkGray,
Qt::blue,
Qt::red,
Qt::green,
Qt::yellow,
Qt::magenta,
Qt::cyan,
Qt::gray
};
//--------------------------------------------------------------------------------------------------
/// Pick default curve color from an index based palette
//--------------------------------------------------------------------------------------------------
cvf::Color3f curveColorFromTable(int colorIndex)
{
QColor color = QColor(Qt::GlobalColor(RI_LOGPLOT_CURVECOLORS[colorIndex % RI_LOGPLOT_CURVECOLORSCOUNT]));
++colorIndex;
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
return cvfColor;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -276,17 +307,41 @@ void RimSummaryCurveFilter::syncCurvesFromUiSelection()
// Create all new curves that is missing // Create all new curves that is missing
int colorIndex = 2;
int lineStyleIdx = -1;
RimSummaryCase* prevCase = nullptr;
RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID;
for (auto& caseAddrPair: newCurveDefinitions) for (auto& caseAddrPair: newCurveDefinitions)
{ {
RimSummaryCase* currentCase = caseAddrPair.first; RimSummaryCase* currentCase = caseAddrPair.first;
RimSummaryCurve* curve = new RimSummaryCurve();
RimSummaryCurve* curve = new RimSummaryCurve();
curve->setParentQwtPlot(m_parentQwtPlot); curve->setParentQwtPlot(m_parentQwtPlot);
curve->setSummaryCase(currentCase); curve->setSummaryCase(currentCase);
curve->setSummaryAddress(caseAddrPair.second); curve->setSummaryAddress(caseAddrPair.second);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
if(currentCase != prevCase)
{
prevCase = currentCase;
colorIndex = 2;
lineStyleIdx ++;
lineStyle = caf::AppEnum<RimPlotCurve::LineStyleEnum>::fromIndex(lineStyleIdx%caf::AppEnum<RimPlotCurve::LineStyleEnum>::size());
if(lineStyle == RimPlotCurve::STYLE_NONE)
{
lineStyle = RimPlotCurve::STYLE_SOLID;
lineStyleIdx++;
}
}
cvf::Color3f curveColor = curveColorFromTable(colorIndex);
colorIndex++;
curve->setColor(curveColor); curve->setColor(curveColor);
curve->setLineStyle(lineStyle);
m_curves.push_back(curve); m_curves.push_back(curve);
} }
} }