mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#632) Add Eclipse cell to selection and show in 3D view and time history plot
Consolidated remove of model based on name in RimView Cleanup selection and time history plot when project is closed
This commit is contained in:
@@ -181,6 +181,8 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose()
|
||||
|
||||
setPdmRoot(NULL);
|
||||
setResultInfo("");
|
||||
|
||||
m_timeHistoryQwtPlot->deleteAllCurves();
|
||||
|
||||
if (m_pdmUiPropertyView)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,14 @@ void RiuSelectionManager::setSelectedItems(const std::vector<RiuSelectionItem*>&
|
||||
m_selection = items;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSelectionManager::appendItemToSelection(RiuSelectionItem* item)
|
||||
{
|
||||
m_selection.push_back(item);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -47,6 +47,10 @@ public:
|
||||
// SelectionManager takes ownership of the selection items
|
||||
void setSelectedItems(const std::vector<RiuSelectionItem*>& items);
|
||||
|
||||
// Append item to selected items in SelectionManager
|
||||
// SelectionManager takes ownership of the item
|
||||
void appendItemToSelection(RiuSelectionItem* item);
|
||||
|
||||
// Deletes all items in the SelectionManager
|
||||
void deleteAllItems();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
|
||||
{
|
||||
CVF_ASSERT(dateTimes.size() == timeHistoryValues.size());
|
||||
|
||||
@@ -94,7 +94,6 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector
|
||||
plotCurve->setLineSegmentStartStopIndices(filteredIntervals);
|
||||
plotCurve->setTitle(curveName);
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
plotCurve->setPen(QPen(QColor(curveColor.rByte(), curveColor.gByte(), curveColor.bByte())));
|
||||
|
||||
plotCurve->attach(this);
|
||||
@@ -108,7 +107,7 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues)
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues)
|
||||
{
|
||||
std::vector<QDateTime> dateTimes;
|
||||
|
||||
@@ -117,7 +116,7 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector
|
||||
dateTimes.push_back(QwtDate::toDateTime(frameTimes[i]));
|
||||
}
|
||||
|
||||
addCurve(curveName, dateTimes, timeHistoryValues);
|
||||
addCurve(curveName, curveColor, dateTimes, timeHistoryValues);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
class QwtPlotCurve;
|
||||
class QwtPlotGrid;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@@ -35,8 +40,8 @@ public:
|
||||
RiuTimeHistoryQwtPlot(QWidget* parent = NULL);
|
||||
virtual ~RiuTimeHistoryQwtPlot();
|
||||
|
||||
void addCurve(const QString& curveName, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues);
|
||||
void addCurve(const QString& curveName, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues);
|
||||
void addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues);
|
||||
void addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues);
|
||||
|
||||
void deleteAllCurves();
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include "RigFemTimeHistoryResultAccessor.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -531,6 +533,11 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
{
|
||||
// Delete all curves if no cell is hit
|
||||
mainWnd->timeHistoryPlot()->deleteAllCurves();
|
||||
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->deleteAllItems();
|
||||
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,10 +574,34 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t
|
||||
curveName += timeHistResultAccessor.topologyText();
|
||||
|
||||
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
|
||||
|
||||
CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size());
|
||||
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, timeHistoryValues);
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->selectedItems(items);
|
||||
|
||||
bool isItemPartOfSelection = false;
|
||||
for (size_t i = 0; i < items.size(); i++)
|
||||
{
|
||||
RiuEclipseSelectionItem* eclSelItem = dynamic_cast<RiuEclipseSelectionItem*>(items[i]);
|
||||
if (eclSelItem &&
|
||||
eclSelItem->m_view == eclipseView &&
|
||||
eclSelItem->m_gridIndex == gridIndex &&
|
||||
eclSelItem->m_cellIndex == cellIndex)
|
||||
{
|
||||
isItemPartOfSelection = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isItemPartOfSelection)
|
||||
{
|
||||
RiuSelectionManager::instance()->appendItemToSelection(new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, curveColor));
|
||||
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, timeStepDates, timeHistoryValues);
|
||||
|
||||
eclipseView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,9 +638,11 @@ void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t
|
||||
}
|
||||
|
||||
CVF_ASSERT(frameTimes.size() == timeHistoryValues.size());
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, frameTimes, timeHistoryValues);
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, frameTimes, timeHistoryValues);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user