#4219 Contact Pressure plots : Add color to annotation lines

This commit is contained in:
Magne Sjaastad 2019-03-22 15:11:56 +01:00
parent 49c66d0a5f
commit 0dd5d40199
7 changed files with 65 additions and 16 deletions

View File

@ -147,7 +147,7 @@ void RimGridCrossPlotCurveSet::setCellFilterView(RimGridView* cellFilterView)
m_xAxisProperty->setResultType(resAddr.m_resultCatType);
m_xAxisProperty->setResultVariable(resAddr.m_resultName);
m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE);
m_yAxisProperty->setResultVariable("DEPTH");
m_yAxisProperty->setResultVariable("DEPTH");
m_timeStep = eclipseView->currentTimeStep();
m_grouping = NO_GROUPING;
@ -158,7 +158,7 @@ void RimGridCrossPlotCurveSet::setCellFilterView(RimGridView* cellFilterView)
parentPlot->setYAxisInverted(true);
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
@ -507,7 +507,7 @@ void RimGridCrossPlotCurveSet::assignCurveDataGroups(const RigEclipseCrossPlotRe
if (!result.groupValuesDiscrete.empty())
m_groupedResults[categoryNum].groupValuesDiscrete.push_back(result.groupValuesDiscrete[i]);
}
}
}
}
}
@ -534,7 +534,7 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
curve->setSamples(result.xValues, result.yValues);
curve->setCurveAutoAppearance();
curve->updateUiIconFromPlotSymbol();
m_crossPlotCurves.push_back(curve);
m_crossPlotCurves.push_back(curve);
}
else
{
@ -1061,6 +1061,13 @@ void RimGridCrossPlotCurveSet::configureForPressureSaturationCurves(RimEclipseRe
m_yAxisProperty->setResultVariable("DEPTH");
m_grouping = NO_GROUPING;
m_nameConfig->setCustomName(dynamicResultName);
m_nameConfig->addCaseName = false;
m_nameConfig->addAxisVariables = false;
m_nameConfig->addTimestep = false;
m_nameConfig->addGrouping = false;
}
//--------------------------------------------------------------------------------------------------

View File

@ -61,6 +61,9 @@ void RimSaturationPressurePlotCollection::createSaturationPressurePlots(RimEclip
plot->setAsPlotMdiWindow();
int equilibriumRegion = static_cast<int>(i);
// As discussed with Liv Merete, it is not any use for creation of different plots for matrix/fracture. For now, use
// hardcoded value for MATRIX
plot->assignCaseAndEquilibriumRegion(RiaDefines::MATRIX_MODEL, eclipseResultCase, equilibriumRegion);
m_saturationPressurePlots.push_back(plot);

View File

@ -116,6 +116,23 @@ double RimPlotAxisAnnotation::value() const
return m_value();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QColor RimPlotAxisAnnotation::color() const
{
if (m_annotationType() == PL_EQUIL_WATER_OIL_CONTACT)
{
return QColor(0, 0, 0);
}
else if (m_annotationType() == PL_EQUIL_GAS_OIL_CONTACT)
{
return QColor(220, 0, 0);
}
return QColor(0, 0, 100);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -54,6 +54,7 @@ public:
QString name() const;
double value() const;
QColor color() const;
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;

View File

@ -28,8 +28,8 @@
#include "cafSelectionManager.h"
#include "cafTitledOverlayFrame.h"
#include "RimPlotAxisProperties.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotAxisProperties.h"
#include "RiuPlotAnnotationTool.h"
#include <QMenu>
@ -130,18 +130,11 @@ void RiuGridCrossQwtPlot::updateLegendSizesToMatchPlot()
//--------------------------------------------------------------------------------------------------
void RiuGridCrossQwtPlot::updateAnnotationObjects(RimPlotAxisProperties* axisProperties)
{
std::vector<QString> names;
std::vector<double> positions;
m_annotationTool->detachAllAnnotations();
for (auto a : axisProperties->annotations())
for (auto annotation : axisProperties->annotations())
{
names.push_back(a->name());
positions.push_back(a->value());
}
if (!names.empty())
{
m_annotationTool->attachWellPicks(this, names, positions);
m_annotationTool->attachAnnotationLine(this, annotation->color(), annotation->name(), annotation->value());
}
}

View File

@ -92,6 +92,22 @@ void RiuPlotAnnotationTool::attachWellPicks(QwtPlot* plot, const std::vector<QSt
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::attachAnnotationLine(QwtPlot* plot,
const QColor& color,
const QString& annotationText,
const double yPosition)
{
m_plot = plot;
QwtPlotMarker* line(new QwtPlotMarker());
RiuPlotAnnotationTool::horizontalDashedLineWithColor(line, color, annotationText, yPosition);
line->attach(m_plot);
m_markers.push_back(std::move(line));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -112,10 +128,18 @@ void RiuPlotAnnotationTool::detachAllAnnotations()
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::horizontalDashedLine(QwtPlotMarker* line, const QString& name, double yValue)
{
horizontalDashedLineWithColor(line, QColor(0, 0, 100), name, yValue);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotAnnotationTool::horizontalDashedLineWithColor(QwtPlotMarker* line, const QColor& color, const QString& name, double yValue)
{
QPen curvePen;
curvePen.setStyle(Qt::DashLine);
curvePen.setColor(QColor(0, 0, 100));
curvePen.setColor(color);
curvePen.setWidth(1);
line->setLineStyle(QwtPlotMarker::HLine);

View File

@ -36,10 +36,14 @@ public:
void attachFormationNames(QwtPlot* plot, const std::vector<QString>& names, const std::vector<std::pair<double, double>> yPositions, bool showNames = true);
void attachWellPicks(QwtPlot* plot, const std::vector<QString>& names, const std::vector<double> yPositions);
void attachAnnotationLine(QwtPlot* plot, const QColor& color, const QString& annotationText, const double yPosition);
void detachAllAnnotations();
private:
static void horizontalDashedLine(QwtPlotMarker* line, const QString& name, double yValue);
static void horizontalDashedLineWithColor(QwtPlotMarker* line, const QColor& color, const QString& name, double yValue);
private:
QPointer<QwtPlot> m_plot;