mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#780 A prototype of linetype pr case color pr var mode
This commit is contained in:
parent
f581c172f6
commit
268d8dda68
@ -375,5 +375,12 @@ void RimPlotCurve::loadDataAndUpdate()
|
||||
this->onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setLineStyle(LineStyleEnum lineStyle)
|
||||
{
|
||||
m_lineStyle = lineStyle;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
QwtPlotCurve* qwtPlotCurve() const;
|
||||
|
||||
void setColor(const cvf::Color3f& color);
|
||||
void setLineStyle(LineStyleEnum lineStyle);
|
||||
bool isCurveVisible() const;
|
||||
QString curveName() const { return m_curveName; }
|
||||
|
||||
|
@ -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
|
||||
int colorIndex = 2;
|
||||
int lineStyleIdx = -1;
|
||||
|
||||
RimSummaryCase* prevCase = nullptr;
|
||||
RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID;
|
||||
|
||||
for (auto& caseAddrPair: newCurveDefinitions)
|
||||
{
|
||||
RimSummaryCase* currentCase = caseAddrPair.first;
|
||||
RimSummaryCurve* curve = new RimSummaryCurve();
|
||||
|
||||
|
||||
RimSummaryCurve* curve = new RimSummaryCurve();
|
||||
curve->setParentQwtPlot(m_parentQwtPlot);
|
||||
curve->setSummaryCase(currentCase);
|
||||
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->setLineStyle(lineStyle);
|
||||
|
||||
m_curves.push_back(curve);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user