mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1322 Added GridTimeHistoryCurve and topology picking items
This commit is contained in:
parent
aae4751ede
commit
388fa2b70e
@ -88,6 +88,9 @@ ${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimNamedObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPickingTopologyItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseTopologyItem.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -174,6 +177,9 @@ ${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimNamedObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPickingTopologyItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseTopologyItem.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
111
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.cpp
Normal file
111
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimEclipseTopologyItem.h"
|
||||
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseTopologyItem, "RimEclipseTopologyItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseTopologyItem::RimEclipseTopologyItem()
|
||||
{
|
||||
CAF_PDM_InitObject("Eclipse Topoloty Item", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "m_gridIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "m_cellIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "m_localIntersectionPoint", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseTopologyItem::~RimEclipseTopologyItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseTopologyItem::setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem)
|
||||
{
|
||||
m_gridIndex = selectionItem->m_gridIndex;
|
||||
m_cellIndex = selectionItem->m_cellIndex;
|
||||
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
|
||||
|
||||
m_eclipseCase = selectionItem->m_view->eclipseCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseTopologyItem::topologyText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
if (m_eclipseCase)
|
||||
{
|
||||
text += m_eclipseCase->caseUserDescription();
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "No case";
|
||||
}
|
||||
|
||||
text += ", ";
|
||||
text += QString("Grid index %1").arg(m_gridIndex);
|
||||
text += ", ";
|
||||
text += RigTimeHistoryResultAccessor::topologyText(m_eclipseCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimEclipseTopologyItem::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseTopologyItem::gridIndex() const
|
||||
{
|
||||
return m_gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseTopologyItem::cellIndex() const
|
||||
{
|
||||
return m_cellIndex;
|
||||
}
|
56
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.h
Normal file
56
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.h
Normal file
@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimPickingTopologyItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEclipseCase;
|
||||
class RiuEclipseSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEclipseTopologyItem : public RimPickingTopologyItem
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimEclipseTopologyItem();
|
||||
virtual ~RimEclipseTopologyItem() override;
|
||||
|
||||
void setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem);
|
||||
|
||||
virtual QString topologyText() const override;
|
||||
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
size_t gridIndex() const;
|
||||
size_t cellIndex() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
|
||||
caf::PdmField<size_t> m_gridIndex;
|
||||
caf::PdmField<size_t> m_cellIndex;
|
||||
caf::PdmField<cvf::Vec3d> m_localIntersectionPoint;
|
||||
};
|
||||
|
381
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp
Normal file
381
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp
Normal file
@ -0,0 +1,381 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimGridTimeHistoryCurve.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseTopologyItem.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGridTimeHistoryCurve, "TimeHistoryCurve");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridTimeHistoryCurve::RimGridTimeHistoryCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Grid Time History Curve", ":/SummaryCurve16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_topologyText, "TopologyText", "TopologyText", "", "", "");
|
||||
m_topologyText.registerGetMethod(this, &RimGridTimeHistoryCurve::topologyText);
|
||||
m_topologyText.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "ResultDefinition", "Result definition", "", "", "");
|
||||
m_eclipseResultDefinition = new RimEclipseResultDefinition();
|
||||
|
||||
// Set to hidden to avoid this item to been displayed as a child item
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
|
||||
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_pickingTopologyItem, "PickingTopologyItem", "Picking Topology Item", "", "", "");
|
||||
m_pickingTopologyItem.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_plotAxis, "PlotAxis", "Axis", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridTimeHistoryCurve::~RimGridTimeHistoryCurve()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::setFromSelectionItem(const RiuSelectionItem* selectionItem)
|
||||
{
|
||||
if (m_pickingTopologyItem())
|
||||
{
|
||||
delete m_pickingTopologyItem();
|
||||
}
|
||||
|
||||
const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>(selectionItem);
|
||||
if (eclSelectionItem)
|
||||
{
|
||||
RimEclipseTopologyItem* topologyItem = new RimEclipseTopologyItem;
|
||||
m_pickingTopologyItem = topologyItem;
|
||||
|
||||
topologyItem->setFromSelectionItem(eclSelectionItem);
|
||||
|
||||
if (eclSelectionItem->m_view)
|
||||
{
|
||||
m_eclipseResultDefinition->simpleCopy(eclSelectionItem->m_view->cellResult());
|
||||
}
|
||||
}
|
||||
|
||||
updateResultDefinitionFromCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDefines::PlotAxis RimGridTimeHistoryCurve::yAxis() const
|
||||
{
|
||||
return m_plotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::setYAxis(RimDefines::PlotAxis plotAxis)
|
||||
{
|
||||
m_plotAxis = plotAxis;
|
||||
|
||||
updateQwtPlotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimGridTimeHistoryCurve::yValues() const
|
||||
{
|
||||
std::vector<double> values;
|
||||
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem && eclTopItem->eclipseCase())
|
||||
{
|
||||
size_t cellIndex = eclTopItem->cellIndex();
|
||||
size_t gridIndex = eclTopItem->gridIndex();
|
||||
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
|
||||
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
|
||||
|
||||
std::vector<QDateTime> timeStepDates = cellResultsData->timeStepDates(m_eclipseResultDefinition->scalarResultIndex());
|
||||
|
||||
values = RigTimeHistoryResultAccessor::timeHistoryValues(eclTopItem->eclipseCase()->eclipseCaseData(), m_eclipseResultDefinition(), gridIndex, cellIndex, timeStepDates.size());
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::quantityName() const
|
||||
{
|
||||
CVF_ASSERT(m_eclipseResultDefinition);
|
||||
|
||||
return m_eclipseResultDefinition->resultVariableUiName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::createCurveAutoName()
|
||||
{
|
||||
QString text;
|
||||
|
||||
QString resName = m_eclipseResultDefinition->resultVariableUiName();
|
||||
if (!resName.isEmpty())
|
||||
{
|
||||
text += resName;
|
||||
}
|
||||
|
||||
if (m_pickingTopologyItem())
|
||||
{
|
||||
if (!text.isEmpty())
|
||||
{
|
||||
text += ", ";
|
||||
}
|
||||
text += m_pickingTopologyItem->topologyText();
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation();
|
||||
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem && eclTopItem->eclipseCase())
|
||||
{
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
|
||||
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
|
||||
|
||||
std::vector<QDateTime> timeStepDates = cellResultsData->timeStepDates(m_eclipseResultDefinition->scalarResultIndex());
|
||||
|
||||
std::vector<double> values = yValues();
|
||||
|
||||
if (isCurveVisible())
|
||||
{
|
||||
std::vector<time_t> dateTimes;
|
||||
for (QDateTime dt : timeStepDates)
|
||||
{
|
||||
dateTimes.push_back(dt.toTime_t());
|
||||
}
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
bool isLogCurve = false;// plot->isLogarithmicScaleEnabled(this->yAxis());
|
||||
|
||||
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
|
||||
{
|
||||
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
|
||||
|
||||
std::vector<double> times;
|
||||
if (dateTimes.size())
|
||||
{
|
||||
time_t startDate = dateTimes[0];
|
||||
for (time_t& date : dateTimes)
|
||||
{
|
||||
times.push_back(timeScale*(date - startDate));
|
||||
}
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
|
||||
}
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
}
|
||||
|
||||
updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted(plot);
|
||||
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
|
||||
uiOrdering.add(&m_topologyText);
|
||||
|
||||
// Fields declared in RimResultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
m_eclipseResultDefinition->defineUiOrdering(uiConfigName, *group1);
|
||||
|
||||
uiOrdering.add(&m_plotAxis);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::initAfterRead()
|
||||
{
|
||||
updateResultDefinitionFromCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_plotAxis)
|
||||
{
|
||||
updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted(plot);
|
||||
|
||||
plot->updateAxes();
|
||||
}
|
||||
else
|
||||
{
|
||||
RimPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimGridTimeHistoryCurve::mainGrid()
|
||||
{
|
||||
if (eclipseTopologyItem() && eclipseTopologyItem()->eclipseCase() && eclipseTopologyItem()->eclipseCase()->eclipseCaseData())
|
||||
{
|
||||
return eclipseTopologyItem()->eclipseCase()->eclipseCaseData()->mainGrid();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseTopologyItem* RimGridTimeHistoryCurve::eclipseTopologyItem() const
|
||||
{
|
||||
RimPickingTopologyItem* pickItem = m_pickingTopologyItem();
|
||||
|
||||
return dynamic_cast<RimEclipseTopologyItem*>(pickItem);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::updateResultDefinitionFromCase()
|
||||
{
|
||||
if (eclipseTopologyItem())
|
||||
{
|
||||
m_eclipseResultDefinition->setEclipseCase(eclipseTopologyItem()->eclipseCase());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::topologyText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
if (m_pickingTopologyItem())
|
||||
{
|
||||
text = m_pickingTopologyItem->topologyText();
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "No topology";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::updateQwtPlotAxis()
|
||||
{
|
||||
if (m_qwtPlotCurve)
|
||||
{
|
||||
if (this->yAxis() == RimDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setYAxis(QwtPlot::yRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
77
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h
Normal file
77
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h
Normal file
@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimPlotCurve.h"
|
||||
|
||||
#include "RimDefines.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RigMainGrid;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimEclipseTopologyItem;
|
||||
class RimPickingTopologyItem;
|
||||
class RiuSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridTimeHistoryCurve : public RimPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
|
||||
public:
|
||||
RimGridTimeHistoryCurve();
|
||||
virtual ~RimGridTimeHistoryCurve();
|
||||
|
||||
void setFromSelectionItem(const RiuSelectionItem* selectionItem);
|
||||
RimDefines::PlotAxis yAxis() const;
|
||||
void setYAxis(RimDefines::PlotAxis plotAxis);
|
||||
|
||||
std::vector<double> yValues() const;
|
||||
|
||||
QString quantityName() const;
|
||||
|
||||
protected:
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void updateZoomInParentPlot() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void initAfterRead() override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
RigMainGrid* mainGrid();
|
||||
RimEclipseTopologyItem* eclipseTopologyItem() const;
|
||||
void updateResultDefinitionFromCase();
|
||||
QString topologyText() const;
|
||||
void updateQwtPlotAxis();
|
||||
|
||||
private:
|
||||
caf::PdmProxyValueField<QString> m_topologyText;
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
|
||||
caf::PdmChildField<RimPickingTopologyItem*> m_pickingTopologyItem;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PlotAxis > > m_plotAxis;
|
||||
};
|
||||
|
38
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.cpp
Normal file
38
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimPickingTopologyItem.h"
|
||||
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimPickingTopologyItem, "RimPickingTopologyItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPickingTopologyItem::RimPickingTopologyItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPickingTopologyItem::~RimPickingTopologyItem()
|
||||
{
|
||||
|
||||
}
|
32
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.h
Normal file
32
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.h
Normal file
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "cafPdmObject.h"
|
||||
|
||||
class RimPickingTopologyItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimPickingTopologyItem();
|
||||
virtual ~RimPickingTopologyItem();
|
||||
|
||||
virtual QString topologyText() const = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user