mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Custom color and custom plot title
This commit is contained in:
parent
614a3628f0
commit
69c264edf5
@ -821,6 +821,14 @@ RimPlotAxisProperties* RimGridCrossPlot::yAxisProperties()
|
||||
return m_yAxisProperties();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlotNameConfig* RimGridCrossPlot::nameConfig()
|
||||
{
|
||||
return m_nameConfig();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Name Configuration
|
||||
///
|
||||
|
@ -109,6 +109,8 @@ protected:
|
||||
RimPlotAxisProperties* xAxisProperties();
|
||||
RimPlotAxisProperties* yAxisProperties();
|
||||
|
||||
RimGridCrossPlotNameConfig* nameConfig();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<int> m_legendFontSize;
|
||||
|
@ -15,6 +15,7 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimGridCrossPlotCurveSet.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@ -114,6 +115,9 @@ RimGridCrossPlotCurveSet::RimGridCrossPlotCurveSet()
|
||||
CAF_PDM_InitFieldNoDefault(&m_crossPlotCurves, "CrossPlotCurves", "Curves", "", "", "");
|
||||
m_crossPlotCurves.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_useCustomColor, "UseCustomColor", false, "Use Custom Color", "", "", "");
|
||||
CAF_PDM_InitField(&m_customColor, "CustomColor", cvf::Color3f(cvf::Color3f::BLACK), "Custom Color", "", "", "");
|
||||
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
@ -427,11 +431,18 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
|
||||
m_groupedResults.clear();
|
||||
if (!groupingEnabled())
|
||||
{
|
||||
const caf::ColorTable& colors = RiaColorTables::contrastCategoryPaletteColors();
|
||||
int colorIndex = indexInPlot();
|
||||
|
||||
RimGridCrossPlotCurve* curve = new RimGridCrossPlotCurve();
|
||||
curve->setColor(colors.cycledColor3f(colorIndex));
|
||||
if (m_useCustomColor)
|
||||
{
|
||||
curve->setColor(m_customColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
const caf::ColorTable& colors = RiaColorTables::contrastCategoryPaletteColors();
|
||||
int colorIndex = indexInPlot();
|
||||
curve->setColor(colors.cycledColor3f(colorIndex));
|
||||
}
|
||||
curve->setGroupingInformation(indexInPlot(), 0);
|
||||
curve->setSamples(result.xValues, result.yValues);
|
||||
curve->updateCurveAppearance();
|
||||
@ -916,6 +927,18 @@ void RimGridCrossPlotCurveSet::setFromCaseAndEquilibriumRegion(RimEclipseResultC
|
||||
m_yAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE);
|
||||
m_yAxisProperty->setResultVariable("DEPTH");
|
||||
|
||||
m_grouping = NO_GROUPING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurveSet::setCustomColor(const cvf::Color3f color)
|
||||
{
|
||||
m_useCustomColor = true;
|
||||
m_customColor = color;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,6 +30,9 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include <cvfArray.h>
|
||||
|
||||
#include <QList>
|
||||
@ -122,6 +125,7 @@ public:
|
||||
bool isYAxisLogarithmic() const;
|
||||
|
||||
void setFromCaseAndEquilibriumRegion(RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName);
|
||||
void setCustomColor(const cvf::Color3f color);
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
@ -162,4 +166,6 @@ private:
|
||||
|
||||
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
|
||||
|
||||
caf::PdmField<bool> m_useCustomColor;
|
||||
caf::PdmField<cvf::Color3f> m_customColor;
|
||||
};
|
||||
|
@ -38,17 +38,27 @@ RimSaturationPressurePlot::RimSaturationPressurePlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion(RimEclipseResultCase* eclipseResultCase, int equilibriumRegion)
|
||||
{
|
||||
nameConfig()->addDataSetNames = false;
|
||||
|
||||
QString caseName = eclipseResultCase->caseUserDescription();
|
||||
QString plotTitle = QString("%1 - EQLNUM %2").arg(caseName).arg(equilibriumRegion);
|
||||
|
||||
nameConfig()->setCustomName(plotTitle);
|
||||
|
||||
{
|
||||
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
|
||||
curveSet->setFromCaseAndEquilibriumRegion(eclipseResultCase, "PRESSURE");
|
||||
curveSet->setCustomColor(cvf::Color3::BLUE);
|
||||
}
|
||||
{
|
||||
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
|
||||
curveSet->setFromCaseAndEquilibriumRegion(eclipseResultCase, "PDEW");
|
||||
curveSet->setCustomColor(cvf::Color3::RED);
|
||||
}
|
||||
{
|
||||
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
|
||||
curveSet->setFromCaseAndEquilibriumRegion(eclipseResultCase, "PBUB");
|
||||
curveSet->setCustomColor(cvf::Color3::GREEN);
|
||||
}
|
||||
|
||||
RimPlotAxisProperties* yAxisProps = yAxisProperties();
|
||||
|
Loading…
Reference in New Issue
Block a user