mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'annotation-items' into dev
This commit is contained in:
@@ -129,6 +129,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRiuQwtPlotOwnerInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
|
||||
)
|
||||
|
||||
|
||||
@@ -261,6 +262,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -4,13 +4,18 @@ ${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurveSet.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlotCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurveSet.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurveSet.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlotCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellPropertyFilter.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellPropertyFilter.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\GridCrossPlots\\CellFilters" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlotCellFilter.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum<RimPlotCellFilter::FilterModeType>::setUp()
|
||||
{
|
||||
addItem(RimPlotCellFilter::INCLUDE, "INCLUDE", "Include");
|
||||
addItem(RimPlotCellFilter::EXCLUDE, "EXCLUDE", "Exclude");
|
||||
setDefault(RimPlotCellFilter::INCLUDE);
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT(RimPlotCellFilter, "RimPlotCellFilter");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellFilter::RimPlotCellFilter()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&m_filterMode, "FilterMode", "Filter Mode", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilter::updateCellVisibility(size_t timeStepIndex, cvf::UByteArray* cellVisibility)
|
||||
{
|
||||
if (isChecked())
|
||||
{
|
||||
updateCellVisibilityFromFilter(timeStepIndex, cellVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellFilter::FilterModeType RimPlotCellFilter::filterMode() const
|
||||
{
|
||||
return m_filterMode();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotCellFilter : public RimCheckableNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum FilterModeType
|
||||
{
|
||||
INCLUDE,
|
||||
EXCLUDE
|
||||
};
|
||||
|
||||
public:
|
||||
RimPlotCellFilter();
|
||||
|
||||
void updateCellVisibility(size_t timeStepIndex, cvf::UByteArray* cellVisibility);
|
||||
FilterModeType filterMode() const;
|
||||
|
||||
protected:
|
||||
virtual void updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility) = 0;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<FilterModeType>> m_filterMode;
|
||||
};
|
||||
@@ -0,0 +1,96 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlotCellFilterCollection.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPlotCellFilterCollection, "RimPlotCellFilterCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellFilterCollection::RimPlotCellFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Plot Cell Filters", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellFilters, "CellFilters", "Cell Filters", "", "", "");
|
||||
m_cellFilters.uiCapability()->setUiHidden(true);
|
||||
|
||||
setName("Filter Collection");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::addCellFilter(RimPlotCellFilter* cellFilter)
|
||||
{
|
||||
m_cellFilters.push_back(cellFilter);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimPlotCellFilterCollection::cellFilterCount() const
|
||||
{
|
||||
return m_cellFilters.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::computeCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility)
|
||||
{
|
||||
if (isChecked())
|
||||
{
|
||||
updateCellVisibilityFromFilter(timeStepIndex, cellVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::setCase(RimCase* gridCase)
|
||||
{
|
||||
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(gridCase);
|
||||
if (eclipseResultCase)
|
||||
{
|
||||
std::vector<RimEclipseResultDefinition*> resultDefinitions;
|
||||
|
||||
this->descendantsIncludingThisOfType(resultDefinitions);
|
||||
for (auto r : resultDefinitions)
|
||||
{
|
||||
r->setEclipseCase(eclipseResultCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility)
|
||||
{
|
||||
for (RimPlotCellFilter* f : m_cellFilters())
|
||||
{
|
||||
if (f->isChecked())
|
||||
{
|
||||
f->updateCellVisibility(timeStepIndex, cellVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPlotCellFilter.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
class RimCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotCellFilterCollection : public RimPlotCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotCellFilterCollection();
|
||||
|
||||
void addCellFilter(RimPlotCellFilter* cellFilter);
|
||||
size_t cellFilterCount() const;
|
||||
|
||||
void computeCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility);
|
||||
|
||||
void setCase(RimCase* gridCase);
|
||||
|
||||
protected:
|
||||
void updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimPlotCellFilter*> m_cellFilters;
|
||||
};
|
||||
@@ -0,0 +1,228 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlotCellPropertyFilter.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPlotCellPropertyFilter, "RimPlotCellPropertyFilter");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellPropertyFilter::RimPlotCellPropertyFilter()
|
||||
{
|
||||
CAF_PDM_InitObject("Plot Cell Property Filter", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "");
|
||||
|
||||
// Set to hidden to avoid this item to been displayed as a child item
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
m_resultDefinition.uiCapability()->setUiHidden(true);
|
||||
m_resultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_lowerBound, "LowerBound", 0.0, "Min", "", "", "");
|
||||
m_lowerBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_upperBound, "UpperBound", 0.0, "Max", "", "", "");
|
||||
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::setResultDefinition(caf::PdmObject* resultDefinition)
|
||||
{
|
||||
m_resultDefinition = resultDefinition;
|
||||
|
||||
updateName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::setValueRange(double lowerBound, double upperBound)
|
||||
{
|
||||
m_lowerBound = lowerBound;
|
||||
m_upperBound = upperBound;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultDefinition* RimPlotCellPropertyFilter::eclipseResultDefinition()
|
||||
{
|
||||
caf::PdmObject* pdmObj = m_resultDefinition;
|
||||
|
||||
return dynamic_cast<RimEclipseResultDefinition*>(pdmObj);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::findOrComputeMinMaxResultValues(double& minimumValue, double& maximumValue)
|
||||
{
|
||||
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
|
||||
if (resDef)
|
||||
{
|
||||
RimEclipseCase* eclCase = resDef->eclipseCase();
|
||||
if (!eclCase) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclCase->eclipseCaseData();
|
||||
if (!eclipseCaseData) return;
|
||||
|
||||
resDef->loadResult();
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults();
|
||||
if (!cellResultsData) return;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues(resDef->eclipseResultAddress(), minimumValue, maximumValue);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::updateName()
|
||||
{
|
||||
QString name = "Property filter - ";
|
||||
|
||||
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
|
||||
if (resDef)
|
||||
{
|
||||
name += resDef->resultVariableUiName();
|
||||
}
|
||||
|
||||
setName(name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* visibleCells)
|
||||
{
|
||||
CVF_ASSERT(visibleCells);
|
||||
|
||||
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
|
||||
if (resDef)
|
||||
{
|
||||
RimEclipseCase* eclCase = resDef->eclipseCase();
|
||||
if (!eclCase) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclCase->eclipseCaseData();
|
||||
if (!eclipseCaseData) return;
|
||||
|
||||
resDef->loadResult();
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults();
|
||||
if (!cellResultsData) return;
|
||||
|
||||
const std::vector<double>& cellResultValues =
|
||||
cellResultsData->cellScalarResults(resDef->eclipseResultAddress(), timeStepIndex);
|
||||
if (cellResultValues.empty()) return;
|
||||
|
||||
const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo();
|
||||
size_t totalReservoirCellCount = actCellInfo->reservoirCellCount();
|
||||
|
||||
if (visibleCells->size() < totalReservoirCellCount)
|
||||
{
|
||||
QString message = QString("Size of visible Cells (%1) is less than total cell count (%2)")
|
||||
.arg(visibleCells->size())
|
||||
.arg(totalReservoirCellCount);
|
||||
|
||||
RiaLogging::error(message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool isUsingGlobalActiveIndex = cellResultsData->isUsingGlobalActiveIndex(resDef->eclipseResultAddress());
|
||||
double lowerBound = m_lowerBound;
|
||||
double upperBound = m_upperBound;
|
||||
size_t cellResultIndex = 0;
|
||||
double scalarValue = 0.0;
|
||||
FilterModeType currentFilterMode = filterMode();
|
||||
|
||||
for (size_t reservoirCellIndex = 0; reservoirCellIndex < totalReservoirCellCount; ++reservoirCellIndex)
|
||||
{
|
||||
if (!actCellInfo->isActive(reservoirCellIndex)) continue;
|
||||
|
||||
cellResultIndex = reservoirCellIndex;
|
||||
if (isUsingGlobalActiveIndex)
|
||||
{
|
||||
cellResultIndex = actCellInfo->cellResultIndex(reservoirCellIndex);
|
||||
}
|
||||
|
||||
if (cellResultIndex != cvf::UNDEFINED_SIZE_T && cellResultIndex < cellResultValues.size())
|
||||
{
|
||||
if ((*visibleCells)[reservoirCellIndex])
|
||||
{
|
||||
scalarValue = cellResultValues[cellResultIndex];
|
||||
if (lowerBound <= scalarValue && scalarValue <= upperBound)
|
||||
{
|
||||
if (currentFilterMode == RimPlotCellFilter::EXCLUDE)
|
||||
{
|
||||
(*visibleCells)[reservoirCellIndex] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentFilterMode == RimPlotCellFilter::INCLUDE)
|
||||
{
|
||||
(*visibleCells)[reservoirCellIndex] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &m_lowerBound || field == &m_upperBound)
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
if (!myAttr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double minimumValue = 0.0;
|
||||
double maximumValue = 0.0;
|
||||
|
||||
findOrComputeMinMaxResultValues(minimumValue, maximumValue);
|
||||
|
||||
myAttr->m_minimum = minimumValue;
|
||||
myAttr->m_maximum = maximumValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPlotCellFilter.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
|
||||
class RimEclipseResultDefinition;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotCellPropertyFilter : public RimPlotCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotCellPropertyFilter();
|
||||
|
||||
// Currently supported result definition is RimEclipseResultDefinition, but the interface is designed to also support
|
||||
// RimGeoMechResultDefinition
|
||||
void setResultDefinition(caf::PdmObject* resultDefinition);
|
||||
|
||||
void setValueRange(double lowerBound, double upperBound);
|
||||
|
||||
protected:
|
||||
void updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* visibleCells) override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
private:
|
||||
RimEclipseResultDefinition* eclipseResultDefinition();
|
||||
void findOrComputeMinMaxResultValues(double& minimumValue, double& maximumValue);
|
||||
void updateName();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<caf::PdmObject*> m_resultDefinition;
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
};
|
||||
@@ -151,6 +151,8 @@ QImage RimGridCrossPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::zoomAll()
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
setAutoZoomForAllAxes(true);
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
|
||||
@@ -277,8 +279,14 @@ void RimGridCrossPlot::updateAxisScaling()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisDisplay()
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
|
||||
|
||||
m_qwtPlot->updateAnnotationObjects(m_xAxisProperties);
|
||||
m_qwtPlot->updateAnnotationObjects(m_yAxisProperties);
|
||||
|
||||
m_qwtPlot->replot();
|
||||
}
|
||||
|
||||
@@ -667,6 +675,8 @@ QString RimGridCrossPlot::yAxisParameterString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
||||
QString axisParameterString = xAxisParameterString();
|
||||
|
||||
@@ -803,6 +813,30 @@ std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
|
||||
return plotCurves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisProperties* RimGridCrossPlot::xAxisProperties()
|
||||
{
|
||||
return m_xAxisProperties();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisProperties* RimGridCrossPlot::yAxisProperties()
|
||||
{
|
||||
return m_yAxisProperties();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlotNameConfig* RimGridCrossPlot::nameConfig()
|
||||
{
|
||||
return m_nameConfig();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Name Configuration
|
||||
///
|
||||
|
||||
@@ -106,6 +106,11 @@ protected:
|
||||
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
|
||||
std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
|
||||
|
||||
RimPlotAxisProperties* xAxisProperties();
|
||||
RimPlotAxisProperties* yAxisProperties();
|
||||
|
||||
RimGridCrossPlotNameConfig* nameConfig();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<int> m_legendFontSize;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@@ -43,8 +42,4 @@ public:
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimGridCrossPlotCurveSet.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@@ -36,9 +37,10 @@
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCurve.h"
|
||||
#include "RimGridView.h"
|
||||
@@ -46,6 +48,8 @@
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "CellFilters/RimPlotCellFilterCollection.h"
|
||||
|
||||
#include "cafCategoryMapper.h"
|
||||
#include "cafColorTable.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
@@ -70,7 +74,7 @@ void RimGridCrossPlotCurveSet::CurveGroupingEnum::setUp()
|
||||
addItem(RigGridCrossPlotCurveGrouping::GROUP_BY_RESULT, "RESULT", "Result Property");
|
||||
setDefault(RigGridCrossPlotCurveGrouping::GROUP_BY_TIME);
|
||||
}
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -113,6 +117,13 @@ 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", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_plotCellFilterCollection, "PlotCellFilterCollection", "Cell Filters", "", "", "");
|
||||
m_plotCellFilterCollection.uiCapability()->setUiTreeHidden(true);
|
||||
m_plotCellFilterCollection = new RimPlotCellFilterCollection;
|
||||
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
@@ -220,7 +231,7 @@ QString RimGridCrossPlotCurveSet::createAutoName() const
|
||||
|
||||
if (m_nameConfig->addTimestep() && !timeStepString().isEmpty())
|
||||
{
|
||||
nameTags += timeStepString();
|
||||
nameTags += timeStepString();
|
||||
}
|
||||
|
||||
if (m_nameConfig->addGrouping() && groupParameter() != "None")
|
||||
@@ -319,7 +330,7 @@ QString RimGridCrossPlotCurveSet::caseNameString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridCrossPlotCurveSet::axisVariableString() const
|
||||
{
|
||||
return QString("%1 x %2").arg(xAxisName(), yAxisName());
|
||||
return QString("%1 x %2").arg(xAxisName(), yAxisName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -358,18 +369,13 @@ std::vector<QString> RimGridCrossPlotCurveSet::groupStrings() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<RimGridCrossPlotCurveSet::NameComponents, QString>
|
||||
RimGridCrossPlotCurveSet::nameComponents() const
|
||||
std::map<RimGridCrossPlotCurveSet::NameComponents, QString> RimGridCrossPlotCurveSet::nameComponents() const
|
||||
{
|
||||
std::map<RimGridCrossPlotCurveSet::NameComponents, QString> componentNames;
|
||||
if (m_nameConfig->addCaseName())
|
||||
componentNames[GCP_CASE_NAME] = caseNameString();
|
||||
if (m_nameConfig->addAxisVariables())
|
||||
componentNames[GCP_AXIS_VARIABLES] = axisVariableString();
|
||||
if (m_nameConfig->addTimestep())
|
||||
componentNames[GCP_TIME_STEP] = timeStepString();
|
||||
if (m_nameConfig->addGrouping())
|
||||
componentNames[GCP_GROUP_NAME] = groupTitle();
|
||||
if (m_nameConfig->addCaseName()) componentNames[GCP_CASE_NAME] = caseNameString();
|
||||
if (m_nameConfig->addAxisVariables()) componentNames[GCP_AXIS_VARIABLES] = axisVariableString();
|
||||
if (m_nameConfig->addTimestep()) componentNames[GCP_TIME_STEP] = timeStepString();
|
||||
if (m_nameConfig->addGrouping()) componentNames[GCP_GROUP_NAME] = groupTitle();
|
||||
|
||||
return componentNames;
|
||||
}
|
||||
@@ -385,6 +391,7 @@ void RimGridCrossPlotCurveSet::initAfterRead()
|
||||
m_xAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_yAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_groupingProperty->setEclipseCase(eclipseCase);
|
||||
m_plotCellFilterCollection->setCase(eclipseCase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +401,7 @@ void RimGridCrossPlotCurveSet::initAfterRead()
|
||||
void RimGridCrossPlotCurveSet::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
{
|
||||
updateDataSetName();
|
||||
|
||||
|
||||
detachAllCurves();
|
||||
m_crossPlotCurves.deleteAllChildObjects();
|
||||
|
||||
@@ -402,7 +409,7 @@ void RimGridCrossPlotCurveSet::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
||||
|
||||
if (eclipseCase == nullptr)
|
||||
@@ -448,11 +455,17 @@ 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();
|
||||
@@ -468,10 +481,8 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
|
||||
{
|
||||
for (size_t i = 0; i < result.xValues.size(); ++i)
|
||||
{
|
||||
int categoryNum =
|
||||
m_grouping == GROUP_BY_RESULT
|
||||
? static_cast<int>(result.groupValuesContinuous[i])
|
||||
: result.groupValuesDiscrete[i];
|
||||
int categoryNum = m_grouping == GROUP_BY_RESULT ? static_cast<int>(result.groupValuesContinuous[i])
|
||||
: result.groupValuesDiscrete[i];
|
||||
|
||||
m_groupedResults[categoryNum].xValues.push_back(result.xValues[i]);
|
||||
m_groupedResults[categoryNum].yValues.push_back(result.yValues[i]);
|
||||
@@ -479,7 +490,6 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
|
||||
m_groupedResults[categoryNum].groupValuesContinuous.push_back(result.groupValuesContinuous[i]);
|
||||
if (!result.groupValuesDiscrete.empty())
|
||||
m_groupedResults[categoryNum].groupValuesDiscrete.push_back(result.groupValuesDiscrete[i]);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -488,9 +498,9 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
|
||||
|
||||
for (size_t i = 0; i < result.xValues.size(); ++i)
|
||||
{
|
||||
auto upperBoundIt = std::lower_bound(tickValues.begin(), tickValues.end(), result.groupValuesContinuous[i]);
|
||||
auto upperBoundIt = std::lower_bound(tickValues.begin(), tickValues.end(), result.groupValuesContinuous[i]);
|
||||
int upperBoundIndex = static_cast<int>(upperBoundIt - tickValues.begin());
|
||||
int categoryNum = std::min((int) tickValues.size() - 2, std::max(0, upperBoundIndex - 1));
|
||||
int categoryNum = std::min((int)tickValues.size() - 2, std::max(0, upperBoundIndex - 1));
|
||||
m_groupedResults[categoryNum].xValues.push_back(result.xValues[i]);
|
||||
m_groupedResults[categoryNum].yValues.push_back(result.yValues[i]);
|
||||
if (!result.groupValuesContinuous.empty())
|
||||
@@ -506,7 +516,7 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
|
||||
curve->setGroupingInformation(indexInPlot(), it->first);
|
||||
if (groupingByCategoryResult())
|
||||
{
|
||||
curve->setColor(cvf::Color3f(legendConfig()->scalarMapper()->mapToColor(it->first)));
|
||||
curve->setColor(cvf::Color3f(legendConfig()->scalarMapper()->mapToColor(it->first)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -571,6 +581,44 @@ std::map<int, cvf::UByteArray> RimGridCrossPlotCurveSet::calculateCellVisibility
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_plotCellFilterCollection->cellFilterCount() > 0)
|
||||
{
|
||||
std::set<int> timeSteps;
|
||||
if (m_timeStep() == -1)
|
||||
{
|
||||
for (int i = 0; i < (int)eclipseCase->timeStepDates().size(); ++i)
|
||||
{
|
||||
timeSteps.insert(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
timeSteps.insert(m_timeStep());
|
||||
}
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
|
||||
if (eclipseCaseData)
|
||||
{
|
||||
RiaDefines::PorosityModelType porosityModel = RiaDefines::MATRIX_MODEL;
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = eclipseCaseData->results(porosityModel);
|
||||
if (cellResultsData)
|
||||
{
|
||||
const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo();
|
||||
size_t cellCount = actCellInfo->reservoirCellCount();
|
||||
|
||||
for (int i : timeSteps)
|
||||
{
|
||||
cvf::UByteArray* cellVisibility = &timeStepCellVisibilityMap[i];
|
||||
cellVisibility->resize(cellCount);
|
||||
cellVisibility->setAll(true);
|
||||
|
||||
m_plotCellFilterCollection->computeCellVisibilityFromFilter(i, cellVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return timeStepCellVisibilityMap;
|
||||
}
|
||||
|
||||
@@ -586,8 +634,7 @@ void RimGridCrossPlotCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&m_cellFilterView);
|
||||
uiOrdering.add(&m_grouping);
|
||||
|
||||
if (m_grouping() == GROUP_BY_TIME &&
|
||||
!(m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult()))
|
||||
if (m_grouping() == GROUP_BY_TIME && !(m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult()))
|
||||
{
|
||||
m_grouping = NO_GROUPING;
|
||||
}
|
||||
@@ -659,9 +706,8 @@ void RimGridCrossPlotCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
{
|
||||
legendConfig()->setColorRange(RimRegularLegendConfig::NORMAL);
|
||||
legendConfig()->setMappingMode(RimRegularLegendConfig::LINEAR_DISCRETE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
loadDataAndUpdate(true);
|
||||
}
|
||||
else if (changedField == &m_cellFilterView)
|
||||
@@ -720,7 +766,7 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotCurveSet::calculateValueOptions(co
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_grouping)
|
||||
{
|
||||
std::set<RigGridCrossPlotCurveGrouping> validOptions = { NO_GROUPING, GROUP_BY_TIME, GROUP_BY_FORMATION, GROUP_BY_RESULT };
|
||||
std::set<RigGridCrossPlotCurveGrouping> validOptions = {NO_GROUPING, GROUP_BY_TIME, GROUP_BY_FORMATION, GROUP_BY_RESULT};
|
||||
if (!hasMultipleTimeSteps())
|
||||
{
|
||||
validOptions.erase(GROUP_BY_TIME);
|
||||
@@ -772,9 +818,9 @@ void RimGridCrossPlotCurveSet::updateLegend()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_grouping() == GROUP_BY_TIME)
|
||||
else if (m_grouping() == GROUP_BY_TIME)
|
||||
{
|
||||
QStringList timeStepNames = m_case->timeStepStrings();
|
||||
QStringList timeStepNames = m_case->timeStepStrings();
|
||||
std::vector<QString> categoryNames;
|
||||
for (auto name : timeStepNames)
|
||||
{
|
||||
@@ -847,7 +893,7 @@ void RimGridCrossPlotCurveSet::swapAxisProperties(bool updatePlot)
|
||||
m_yAxisProperty.removeChildObject(yAxisProperties);
|
||||
m_yAxisProperty = xAxisProperties;
|
||||
m_xAxisProperty = yAxisProperties;
|
||||
|
||||
|
||||
updateConnectedEditors();
|
||||
loadDataAndUpdate(updatePlot);
|
||||
}
|
||||
@@ -857,8 +903,7 @@ void RimGridCrossPlotCurveSet::swapAxisProperties(bool updatePlot)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter& formatter) const
|
||||
{
|
||||
if (m_groupedResults.empty())
|
||||
return;
|
||||
if (m_groupedResults.empty()) return;
|
||||
|
||||
if (m_grouping != NO_GROUPING)
|
||||
{
|
||||
@@ -891,8 +936,8 @@ void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter&
|
||||
}
|
||||
else
|
||||
{
|
||||
int groupIndex = it->first;
|
||||
QString groupName = createGroupName(groupIndex);
|
||||
int groupIndex = it->first;
|
||||
QString groupName = createGroupName(groupIndex);
|
||||
formatter.add(res.xValues[i]);
|
||||
formatter.add(res.yValues[i]);
|
||||
formatter.add(groupIndex);
|
||||
@@ -923,6 +968,42 @@ bool RimGridCrossPlotCurveSet::isYAxisLogarithmic() const
|
||||
return parent->isYAxisLogarithmic();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurveSet::configureForPressureSaturationCurves(RimEclipseResultCase* eclipseCase,
|
||||
const QString& dynamicResultName)
|
||||
{
|
||||
m_case = eclipseCase;
|
||||
|
||||
m_xAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_xAxisProperty->setResultType(RiaDefines::DYNAMIC_NATIVE);
|
||||
m_xAxisProperty->setResultVariable(dynamicResultName);
|
||||
|
||||
m_yAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE);
|
||||
m_yAxisProperty->setResultVariable("DEPTH");
|
||||
|
||||
m_grouping = NO_GROUPING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurveSet::addCellFilter(RimPlotCellFilter* cellFilter)
|
||||
{
|
||||
m_plotCellFilterCollection->addCellFilter(cellFilter);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurveSet::setCustomColor(const cvf::Color3f color)
|
||||
{
|
||||
m_useCustomColor = true;
|
||||
m_customColor = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -997,7 +1078,7 @@ void RimGridCrossPlotCurveSet::setDefaults()
|
||||
if (!project->eclipseCases().empty())
|
||||
{
|
||||
RimEclipseCase* eclipseCase = project->eclipseCases().front();
|
||||
m_case = eclipseCase;
|
||||
m_case = eclipseCase;
|
||||
m_xAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_yAxisProperty->setEclipseCase(eclipseCase);
|
||||
m_groupingProperty->setEclipseCase(eclipseCase);
|
||||
@@ -1008,7 +1089,7 @@ void RimGridCrossPlotCurveSet::setDefaults()
|
||||
m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE);
|
||||
m_yAxisProperty->setResultVariable("PERMX");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1035,6 +1116,8 @@ void RimGridCrossPlotCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
|
||||
uiTreeOrdering.add(curve);
|
||||
}
|
||||
|
||||
uiTreeOrdering.add(&m_plotCellFilterCollection);
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
@@ -1044,7 +1127,6 @@ void RimGridCrossPlotCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
|
||||
bool RimGridCrossPlotCurveSet::hasMultipleTimeSteps() const
|
||||
{
|
||||
return m_timeStep() == -1 && (m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1057,13 +1139,12 @@ void RimGridCrossPlotCurveSet::filterInvalidCurveValues(RigEclipseCrossPlotResul
|
||||
|
||||
if (xLog || yLog)
|
||||
{
|
||||
|
||||
RigEclipseCrossPlotResult validResult;
|
||||
for (size_t i = 0; i < result->xValues.size(); ++i)
|
||||
{
|
||||
double xValue = result->xValues[i];
|
||||
double yValue = result->yValues[i];
|
||||
bool invalid = (xLog && xValue <= 0.0) || (yLog && yValue <= 0.0);
|
||||
double xValue = result->xValues[i];
|
||||
double yValue = result->yValues[i];
|
||||
bool invalid = (xLog && xValue <= 0.0) || (yLog && yValue <= 0.0);
|
||||
if (!invalid)
|
||||
{
|
||||
validResult.xValues.push_back(xValue);
|
||||
|
||||
@@ -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>
|
||||
@@ -40,12 +43,15 @@ class RimCase;
|
||||
class RimGridCrossPlotCurve;
|
||||
class RimGridView;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
class RimEclipseCellColors;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimRegularLegendConfig;
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
class QString;
|
||||
class RimPlotCellFilterCollection;
|
||||
class RimPlotCellFilter;
|
||||
|
||||
class RimGridCrossPlotCurveSetNameConfig : public RimNameConfig
|
||||
{
|
||||
@@ -120,6 +126,10 @@ public:
|
||||
bool isXAxisLogarithmic() const;
|
||||
bool isYAxisLogarithmic() const;
|
||||
|
||||
void configureForPressureSaturationCurves(RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName);
|
||||
void addCellFilter(RimPlotCellFilter* cellFilter);
|
||||
void setCustomColor(const cvf::Color3f color);
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void onLoadDataAndUpdate(bool updateParentPlot);
|
||||
@@ -159,4 +169,8 @@ private:
|
||||
|
||||
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
|
||||
|
||||
caf::PdmField<bool> m_useCustomColor;
|
||||
caf::PdmField<cvf::Color3f> m_customColor;
|
||||
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;;
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimGridCrossPlotCurveSet.h"
|
||||
#include "RimPlotAxisAnnotation.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
||||
#include "CellFilters/RimPlotCellPropertyFilter.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSaturationPressurePlot, "RimSaturationPressurePlot");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlot::RimSaturationPressurePlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion(RiaDefines::PorosityModelType porosityModel,
|
||||
RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex)
|
||||
{
|
||||
nameConfig()->addDataSetNames = false;
|
||||
|
||||
QString caseName = eclipseResultCase->caseUserDescription();
|
||||
QString plotTitle = QString("%1 - EQLNUM %2").arg(caseName).arg(zeroBasedEquilRegionIndex + 1);
|
||||
|
||||
nameConfig()->setCustomName(plotTitle);
|
||||
|
||||
auto equilData = eclipseResultCase->eclipseCaseData()->equilData();
|
||||
auto eq = equilData[zeroBasedEquilRegionIndex];
|
||||
|
||||
double gasOilContactDepth = eq.gasOilContactDepth();
|
||||
double waterOilContactDepth = eq.waterOilContactDepth();
|
||||
|
||||
{
|
||||
// Blue PRESSURE curve with data for specified EQLNUM value
|
||||
|
||||
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
|
||||
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PRESSURE");
|
||||
curveSet->setCustomColor(cvf::Color3::BLUE);
|
||||
|
||||
RimPlotCellPropertyFilter* cellFilter =
|
||||
createEquilibriumRegionPropertyFilter(eclipseResultCase, zeroBasedEquilRegionIndex);
|
||||
|
||||
curveSet->addCellFilter(cellFilter);
|
||||
}
|
||||
|
||||
{
|
||||
// Red dew pressure (PDEW) curve with data for specified EQLNUM value, filtered on depth by gasOilContact
|
||||
|
||||
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
|
||||
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PDEW");
|
||||
curveSet->setCustomColor(cvf::Color3::RED);
|
||||
|
||||
RimPlotCellPropertyFilter* cellFilter =
|
||||
createEquilibriumRegionPropertyFilter(eclipseResultCase, zeroBasedEquilRegionIndex);
|
||||
curveSet->addCellFilter(cellFilter);
|
||||
|
||||
{
|
||||
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results(porosityModel);
|
||||
if (caseCellResultsData)
|
||||
{
|
||||
RigEclipseResultAddress depthResultAddress(RiaDefines::STATIC_NATIVE, "DEPTH");
|
||||
|
||||
double minDepth = 0.0;
|
||||
double maxDepth = 0.0;
|
||||
caseCellResultsData->minMaxCellScalarValues(depthResultAddress, minDepth, maxDepth);
|
||||
|
||||
maxDepth = gasOilContactDepth;
|
||||
|
||||
RimPlotCellPropertyFilter* depthCellFilter = createDepthPropertyFilter(eclipseResultCase, minDepth, maxDepth);
|
||||
|
||||
curveSet->addCellFilter(depthCellFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Green bubble point pressure (PBUB) curve with data for specified EQLNUM value, filtered on depth between gasOilContact
|
||||
// and waterOilContactDepth
|
||||
|
||||
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
|
||||
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PBUB");
|
||||
curveSet->setCustomColor(cvf::Color3::GREEN);
|
||||
|
||||
{
|
||||
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
|
||||
{
|
||||
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
|
||||
resultDefinition->setEclipseCase(eclipseResultCase);
|
||||
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
|
||||
resultDefinition->setResultVariable("EQLNUM");
|
||||
|
||||
cellFilter->setResultDefinition(resultDefinition);
|
||||
}
|
||||
|
||||
cellFilter->setValueRange(zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1);
|
||||
|
||||
curveSet->addCellFilter(cellFilter);
|
||||
}
|
||||
|
||||
{
|
||||
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results(porosityModel);
|
||||
if (caseCellResultsData)
|
||||
{
|
||||
RigEclipseResultAddress depthResultAddress(RiaDefines::STATIC_NATIVE, "DEPTH");
|
||||
|
||||
double minDepth = 0.0;
|
||||
double maxDepth = 0.0;
|
||||
caseCellResultsData->minMaxCellScalarValues(depthResultAddress, minDepth, maxDepth);
|
||||
|
||||
minDepth = gasOilContactDepth;
|
||||
maxDepth = waterOilContactDepth;
|
||||
|
||||
RimPlotCellPropertyFilter* depthCellFilter = createDepthPropertyFilter(eclipseResultCase, minDepth, maxDepth);
|
||||
|
||||
curveSet->addCellFilter(depthCellFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimPlotAxisProperties* yAxisProps = yAxisProperties();
|
||||
|
||||
yAxisProps->setInvertedAxis(true);
|
||||
|
||||
{
|
||||
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
|
||||
annotation->setEquilibriumData(
|
||||
eclipseResultCase, zeroBasedEquilRegionIndex, RimPlotAxisAnnotation::PL_EQUIL_GAS_OIL_CONTACT);
|
||||
|
||||
yAxisProps->appendAnnotation(annotation);
|
||||
}
|
||||
{
|
||||
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
|
||||
annotation->setEquilibriumData(
|
||||
eclipseResultCase, zeroBasedEquilRegionIndex, RimPlotAxisAnnotation::PL_EQUIL_WATER_OIL_CONTACT);
|
||||
|
||||
yAxisProps->appendAnnotation(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlot::initAfterRead()
|
||||
{
|
||||
yAxisProperties()->showAnnotationObjectsInProjectTree();
|
||||
|
||||
RimGridCrossPlot::initAfterRead();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellPropertyFilter*
|
||||
RimSaturationPressurePlot::createEquilibriumRegionPropertyFilter(RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex)
|
||||
{
|
||||
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
|
||||
|
||||
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
|
||||
resultDefinition->setEclipseCase(eclipseResultCase);
|
||||
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
|
||||
resultDefinition->setResultVariable("EQLNUM");
|
||||
|
||||
cellFilter->setResultDefinition(resultDefinition);
|
||||
|
||||
cellFilter->setValueRange(zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1);
|
||||
|
||||
return cellFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellPropertyFilter* RimSaturationPressurePlot::createDepthPropertyFilter(RimEclipseResultCase* eclipseResultCase,
|
||||
double minDepth,
|
||||
double maxDepth)
|
||||
{
|
||||
RimPlotCellPropertyFilter* depthCellFilter = new RimPlotCellPropertyFilter();
|
||||
|
||||
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
|
||||
resultDefinition->setEclipseCase(eclipseResultCase);
|
||||
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
|
||||
resultDefinition->setResultVariable("DEPTH");
|
||||
|
||||
depthCellFilter->setResultDefinition(resultDefinition);
|
||||
|
||||
depthCellFilter->setValueRange(minDepth, maxDepth);
|
||||
|
||||
return depthCellFilter;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimPlotCellPropertyFilter;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimSaturationPressurePlot : public RimGridCrossPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSaturationPressurePlot();
|
||||
|
||||
void assignCaseAndEquilibriumRegion(RiaDefines::PorosityModelType porosityModel,
|
||||
RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex);
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
RimPlotCellPropertyFilter* createEquilibriumRegionPropertyFilter(RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex);
|
||||
|
||||
RimPlotCellPropertyFilter*
|
||||
createDepthPropertyFilter(RimEclipseResultCase* eclipseResultCase, double minDepth, double maxDepth);
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSaturationPressurePlotCollection.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimSaturationPressurePlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSaturationPressurePlotCollection, "RimSaturationPressurePlotCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlotCollection::RimSaturationPressurePlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Saturation Pressure Plots", ":/SummaryXPlotsLight16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_saturationPressurePlots, "SaturationPressurePlots", "Saturation Pressure Plots", "", "", "");
|
||||
m_saturationPressurePlots.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlotCollection::~RimSaturationPressurePlotCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlotCollection::createSaturationPressurePlots(RimEclipseResultCase* eclipseResultCase)
|
||||
{
|
||||
if (!eclipseResultCase) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseResultCase->eclipseCaseData();
|
||||
if (!eclipseCaseData) return;
|
||||
|
||||
m_saturationPressurePlots.deleteAllChildObjects();
|
||||
|
||||
std::vector<RigEquil> equilData = eclipseCaseData->equilData();
|
||||
for (size_t i = 0; i < equilData.size(); i++)
|
||||
{
|
||||
RimSaturationPressurePlot* plot = new RimSaturationPressurePlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
int equilibriumRegion = static_cast<int>(i);
|
||||
plot->assignCaseAndEquilibriumRegion(RiaDefines::MATRIX_MODEL, eclipseResultCase, equilibriumRegion);
|
||||
|
||||
m_saturationPressurePlots.push_back(plot);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots()
|
||||
{
|
||||
return m_saturationPressurePlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlotCollection::deleteAllChildObjects()
|
||||
{
|
||||
m_saturationPressurePlots.deleteAllChildObjects();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimSaturationPressurePlot;
|
||||
class RimEclipseResultCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSaturationPressurePlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSaturationPressurePlotCollection();
|
||||
~RimSaturationPressurePlotCollection() override;
|
||||
|
||||
void createSaturationPressurePlots(RimEclipseResultCase* eclipseResultCase);
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> plots();
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimSaturationPressurePlot*> m_saturationPressurePlots;
|
||||
};
|
||||
@@ -95,6 +95,7 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "RimSaturationPressurePlotCollection.h"
|
||||
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
@@ -472,6 +473,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicCreateGridCrossPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSaturationPressurePlotCollection*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicCreateSaturationPressurePlotsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimGridCrossPlot*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicPasteGridCrossPlotCurveSetFeature";
|
||||
|
||||
@@ -186,6 +186,14 @@ void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase)
|
||||
assignFlowSolutionFromCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimEclipseResultDefinition::eclipseCase()
|
||||
{
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
void simpleCopy(const RimEclipseResultDefinition* other);
|
||||
|
||||
void setEclipseCase(RimEclipseCase* eclipseCase);
|
||||
RimEclipseCase* eclipseCase();
|
||||
|
||||
RiaDefines::ResultCatType resultType() const { return m_resultType(); }
|
||||
void setResultType(RiaDefines::ResultCatType val);
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimPltPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRftPlotCollection.h"
|
||||
#include "RimSaturationPressurePlotCollection.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimViewWindow.h"
|
||||
@@ -70,6 +71,9 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridCrossPlotCollection, "Rim3dCrossPlotCollection", "3d Cross Plots", "", "", "");
|
||||
m_gridCrossPlotCollection.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_saturationPressurePlotCollection, "RimSaturationPressurePlotCollection", "Saturation Pressure Plots", "", "", "");
|
||||
m_saturationPressurePlotCollection.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
||||
m_rftPlotCollection = new RimRftPlotCollection();
|
||||
m_pltPlotCollection = new RimPltPlotCollection();
|
||||
@@ -77,6 +81,7 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
m_summaryCrossPlotCollection = new RimSummaryCrossPlotCollection();
|
||||
m_flowPlotCollection = new RimFlowPlotCollection();
|
||||
m_gridCrossPlotCollection = new RimGridCrossPlotCollection;
|
||||
m_saturationPressurePlotCollection = new RimSaturationPressurePlotCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -158,6 +163,14 @@ RimGridCrossPlotCollection* RimMainPlotCollection::gridCrossPlotCollection()
|
||||
return m_gridCrossPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlotCollection* RimMainPlotCollection::saturationPressurePlotCollection()
|
||||
{
|
||||
return m_saturationPressurePlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -170,6 +183,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_summaryCrossPlotCollection()->deleteAllChildObjects();
|
||||
m_gridCrossPlotCollection->deleteAllChildObjects();
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
m_saturationPressurePlotCollection()->deleteAllChildObjects();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,30 +2,29 @@
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
//
|
||||
// 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RimWellLogPlotCollection;
|
||||
class RimRftPlotCollection;
|
||||
@@ -37,46 +36,49 @@ class RimSummaryPlot;
|
||||
class RifReaderEclipseSummary;
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowPlotCollection;
|
||||
|
||||
class RimSaturationPressurePlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimMainPlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimMainPlotCollection();
|
||||
~RimMainPlotCollection() override;
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimRftPlotCollection* rftPlotCollection();
|
||||
RimPltPlotCollection* pltPlotCollection();
|
||||
RimSummaryPlotCollection* summaryPlotCollection();
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotCollection();
|
||||
RimFlowPlotCollection* flowPlotCollection();
|
||||
RimGridCrossPlotCollection* gridCrossPlotCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimRftPlotCollection* rftPlotCollection();
|
||||
RimPltPlotCollection* pltPlotCollection();
|
||||
RimSummaryPlotCollection* summaryPlotCollection();
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotCollection();
|
||||
RimFlowPlotCollection* flowPlotCollection();
|
||||
RimGridCrossPlotCollection* gridCrossPlotCollection();
|
||||
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
void updateCurrentTimeStepInPlots();
|
||||
void updatePlotsWithFormations();
|
||||
void updatePlotsWithCompletions();
|
||||
void deleteAllCachedData();
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
void updateCurrentTimeStepInPlots();
|
||||
void updatePlotsWithFormations();
|
||||
void updatePlotsWithCompletions();
|
||||
void deleteAllCachedData();
|
||||
private:
|
||||
|
||||
// Overridden PDM methods
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
||||
caf::PdmChildField<RimRftPlotCollection*> m_rftPlotCollection;
|
||||
caf::PdmChildField<RimPltPlotCollection*> m_pltPlotCollection;
|
||||
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||
caf::PdmChildField<RimSummaryCrossPlotCollection*> m_summaryCrossPlotCollection;
|
||||
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
|
||||
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
|
||||
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
||||
caf::PdmChildField<RimRftPlotCollection*> m_rftPlotCollection;
|
||||
caf::PdmChildField<RimPltPlotCollection*> m_pltPlotCollection;
|
||||
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||
caf::PdmChildField<RimSummaryCrossPlotCollection*> m_summaryCrossPlotCollection;
|
||||
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
|
||||
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
|
||||
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
|
||||
|
||||
caf::PdmField<bool> m_show;
|
||||
};
|
||||
|
||||
236
ApplicationCode/ProjectDataModel/RimPlotAxisAnnotation.cpp
Normal file
236
ApplicationCode/ProjectDataModel/RimPlotAxisAnnotation.cpp
Normal file
@@ -0,0 +1,236 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlotAxisAnnotation.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RimPlotAxisAnnotation::ExportKeywordEnum::setUp()
|
||||
{
|
||||
addItem(RimPlotAxisAnnotation::PL_USER_DEFINED, "User Defined", "User Defined");
|
||||
addItem(RimPlotAxisAnnotation::PL_EQUIL_WATER_OIL_CONTACT, "PL_EQUIL_WATER_OIL_CONTACT", "PL_EQUIL_WATER_OIL_CONTACT");
|
||||
addItem(RimPlotAxisAnnotation::PL_EQUIL_GAS_OIL_CONTACT, "PL_EQUIL_GAS_OIL_CONTACT", "PL_EQUIL_GAS_OIL_CONTACT");
|
||||
setDefault(RimPlotAxisAnnotation::PL_USER_DEFINED);
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPlotAxisAnnotation, "RimPlotAxisAnnotation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisAnnotation::RimPlotAxisAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("Plot Axis Annotation", ":/LeftAxis16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_value, "Value", "Value", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_annotationType, "AnnotationType", "AnnotationType", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_sourceCase, "Associated3DCase", "Eclipse Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_equilNum, "m_equilNum", "equil Num", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::setName(const QString& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::setValue(double value)
|
||||
{
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::setEquilibriumData(RimEclipseCase* eclipseCase,
|
||||
int zeroBasedEquilRegionIndex,
|
||||
PlotAxisAnnotationType annotationType)
|
||||
{
|
||||
m_sourceCase = eclipseCase;
|
||||
m_equilNum = zeroBasedEquilRegionIndex + 1;
|
||||
m_annotationType = annotationType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotAxisAnnotation::name() const
|
||||
{
|
||||
if (m_annotationType() == PL_EQUIL_WATER_OIL_CONTACT)
|
||||
{
|
||||
QString text = QString("WOC %1").arg(value());
|
||||
return text;
|
||||
}
|
||||
else if (m_annotationType() == PL_EQUIL_GAS_OIL_CONTACT)
|
||||
{
|
||||
QString text = QString("GOC %1").arg(value());
|
||||
return text;
|
||||
}
|
||||
|
||||
return m_name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimPlotAxisAnnotation::value() const
|
||||
{
|
||||
if (m_annotationType() == PL_EQUIL_WATER_OIL_CONTACT)
|
||||
{
|
||||
return selectedItem().waterOilContactDepth();
|
||||
}
|
||||
else if (m_annotationType() == PL_EQUIL_GAS_OIL_CONTACT)
|
||||
{
|
||||
return selectedItem().gasOilContactDepth();
|
||||
}
|
||||
|
||||
return m_value();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotAxisAnnotation::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotAxisAnnotation::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
/*
|
||||
RimViewWindow* viewWindow = nullptr;
|
||||
this->firstAncestorOrThisOfType(viewWindow);
|
||||
if (viewWindow)
|
||||
{
|
||||
viewWindow->loadDataAndUpdate();
|
||||
}
|
||||
*/
|
||||
RimRiuQwtPlotOwnerInterface* parentPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(parentPlot);
|
||||
if (parentPlot)
|
||||
{
|
||||
parentPlot->updateAxisDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPlotAxisAnnotation::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_sourceCase)
|
||||
{
|
||||
RimTools::caseOptionItems(&options);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_equilNum)
|
||||
{
|
||||
for (int i = 0; i < equilItems().size(); i++)
|
||||
{
|
||||
QString uiText = QString("%1").arg(i + 1);
|
||||
options.push_back(caf::PdmOptionItemInfo(uiText, i));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_annotationType);
|
||||
|
||||
if (m_annotationType() == PL_USER_DEFINED)
|
||||
{
|
||||
uiOrdering.add(&m_name);
|
||||
uiOrdering.add(&m_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiOrdering.add(&m_sourceCase);
|
||||
uiOrdering.add(&m_equilNum);
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigEquil RimPlotAxisAnnotation::selectedItem() const
|
||||
{
|
||||
int index = m_equilNum() - 1;
|
||||
|
||||
if (index < equilItems().size())
|
||||
{
|
||||
return equilItems()[index];
|
||||
}
|
||||
|
||||
return RigEquil::defaultObject();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RigEquil> RimPlotAxisAnnotation::equilItems() const
|
||||
{
|
||||
if (m_sourceCase && m_sourceCase->eclipseCaseData())
|
||||
{
|
||||
return m_sourceCase->eclipseCaseData()->equilData();
|
||||
}
|
||||
|
||||
return std::vector<RigEquil>();
|
||||
}
|
||||
82
ApplicationCode/ProjectDataModel/RimPlotAxisAnnotation.h
Normal file
82
ApplicationCode/ProjectDataModel/RimPlotAxisAnnotation.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RigEquil;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotAxisAnnotation : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum PlotAxisAnnotationType
|
||||
{
|
||||
PL_USER_DEFINED,
|
||||
PL_EQUIL_WATER_OIL_CONTACT,
|
||||
PL_EQUIL_GAS_OIL_CONTACT
|
||||
};
|
||||
typedef caf::AppEnum<PlotAxisAnnotationType> ExportKeywordEnum;
|
||||
|
||||
RimPlotAxisAnnotation();
|
||||
|
||||
void setName(const QString& name);
|
||||
void setValue(double value);
|
||||
|
||||
void setEquilibriumData(RimEclipseCase* eclipseCase, int zeroBasedEquilRegionIndex, PlotAxisAnnotationType annotationType);
|
||||
|
||||
QString name() const;
|
||||
double value() const;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly) override;
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
RigEquil selectedItem() const;
|
||||
std::vector<RigEquil> equilItems() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<ExportKeywordEnum> m_annotationType;
|
||||
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<double> m_value;
|
||||
|
||||
caf::PdmPtrField<RimEclipseCase*> m_sourceCase;
|
||||
caf::PdmField<int> m_equilNum;
|
||||
};
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RigStatisticsCalculator.h"
|
||||
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimPlotAxisAnnotation.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
|
||||
@@ -95,6 +96,11 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", "");
|
||||
CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", "", "", "", "");
|
||||
|
||||
m_annotations.uiCapability()->setUiHidden(true);
|
||||
// m_annotations.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
// clang-format on
|
||||
@@ -302,6 +308,22 @@ bool RimPlotAxisProperties::isAxisInverted() const
|
||||
return m_isAxisInverted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotAxisAnnotation*> RimPlotAxisProperties::annotations() const
|
||||
{
|
||||
return m_annotations.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::appendAnnotation(RimPlotAxisAnnotation* annotation)
|
||||
{
|
||||
m_annotations.push_back(annotation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -318,6 +340,22 @@ bool RimPlotAxisProperties::isActive() const
|
||||
return m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setInvertedAxis(bool enable)
|
||||
{
|
||||
m_isAxisInverted = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::showAnnotationObjectsInProjectTree()
|
||||
{
|
||||
m_annotations.uiCapability()->setUiTreeChildrenHidden(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimPlotAxisAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@@ -70,6 +72,9 @@ public:
|
||||
bool isAxisInverted() const;
|
||||
void setAxisInverted(bool inverted);
|
||||
|
||||
std::vector<RimPlotAxisAnnotation*> annotations() const;
|
||||
void appendAnnotation(RimPlotAxisAnnotation* annotation);
|
||||
|
||||
caf::PdmField<QString> customTitle;
|
||||
caf::PdmField<int> titleFontSize;
|
||||
caf::PdmField<caf::AppEnum<AxisTitlePositionType>> titlePositionEnum;
|
||||
@@ -84,6 +89,9 @@ public:
|
||||
caf::PdmField<int> valuesFontSize;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
void setInvertedAxis(bool enable);
|
||||
void showAnnotationObjectsInProjectTree();
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
@@ -113,6 +121,8 @@ private:
|
||||
QwtPlot::Axis m_axis;
|
||||
|
||||
bool m_enableTitleTextSettings;
|
||||
|
||||
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
|
||||
};
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "RimFractureTemplate.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimSaturationPressurePlotCollection.h"
|
||||
#include "RimValveTemplate.h"
|
||||
#include "RimValveTemplateCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@@ -1246,6 +1247,11 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
||||
{
|
||||
itemCollection->add(mainPlotCollection->gridCrossPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->saturationPressurePlotCollection())
|
||||
{
|
||||
itemCollection->add(mainPlotCollection->saturationPressurePlotCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user