ResInsight/ApplicationCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp
2019-03-18 14:31:06 +01:00

91 lines
3.5 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimSaturationPressurePlot.h"
#include "RimEclipseResultCase.h"
#include "RimGridCrossPlotCurveSet.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotAxisProperties.h"
CAF_PDM_SOURCE_INIT(RimSaturationPressurePlot, "RimSaturationPressurePlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSaturationPressurePlot::RimSaturationPressurePlot()
{
CAF_PDM_InitObject("Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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();
yAxisProps->setInvertedAxis(true);
{
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
annotation->setEquilibriumData(eclipseResultCase, equilibriumRegion, RimPlotAxisAnnotation::PL_EQUIL_GAS_OIL_CONTACT);
yAxisProps->appendAnnotation(annotation);
}
{
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
annotation->setEquilibriumData(eclipseResultCase, equilibriumRegion, RimPlotAxisAnnotation::PL_EQUIL_WATER_OIL_CONTACT);
yAxisProps->appendAnnotation(annotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSaturationPressurePlot::initAfterRead()
{
yAxisProperties()->showAnnotationObjectsInProjectTree();
RimGridCrossPlot::initAfterRead();
}