mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1321 Update Flow Characteristics plot when new timesteps arrives.
Added a updateCurrentTimeStepInPlots method Deleted obsolete ifdeffed code from main plot collection
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuProjectPropertyView.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimMainPlotCollection, "MainPlotCollection");
|
||||
|
||||
@@ -52,8 +53,6 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
m_summaryPlotCollection = new RimSummaryPlotCollection();
|
||||
m_flowPlotCollection = new RimFlowPlotCollection();
|
||||
|
||||
//m_plotMainWindow = NULL;
|
||||
//m_plotManagerMainWindow = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -65,8 +64,6 @@ RimMainPlotCollection::~RimMainPlotCollection()
|
||||
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
|
||||
if (m_flowPlotCollection()) delete m_flowPlotCollection();
|
||||
|
||||
//m_plotManagerMainWindow->close();
|
||||
//m_plotManagerMainWindow->deleteLater();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -74,62 +71,9 @@ RimMainPlotCollection::~RimMainPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
#if 0
|
||||
if (changedField == &showWindow)
|
||||
{
|
||||
if (showWindow)
|
||||
{
|
||||
showPlotWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
hidePlotWindow();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::showPlotWindow()
|
||||
{
|
||||
if (!m_plotManagerMainWindow)
|
||||
{
|
||||
m_plotManagerMainWindow = new QMainWindow;
|
||||
m_plotManagerMainWindow->setDockNestingEnabled(true);
|
||||
|
||||
m_plotMainWindow = new QMainWindow;
|
||||
m_plotMainWindow->setDockNestingEnabled(true);
|
||||
|
||||
// NOTE! setCentralWidget takes ownership of widget
|
||||
m_plotManagerMainWindow->setCentralWidget(m_plotMainWindow);
|
||||
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Plots", m_plotManagerMainWindow);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
|
||||
RiuProjectAndPropertyView* projPropView = new RiuProjectAndPropertyView(dockWidget);
|
||||
dockWidget->setWidget(projPropView);
|
||||
|
||||
RimProject* proj = NULL;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
|
||||
projPropView->setPdmItem(this);
|
||||
|
||||
m_plotManagerMainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
}
|
||||
}
|
||||
|
||||
m_plotMainWindow->show();
|
||||
|
||||
m_plotManagerMainWindow->showNormal();
|
||||
m_plotManagerMainWindow->raise();
|
||||
}
|
||||
|
||||
#endif
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -173,115 +117,12 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
}
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::createDockWindowsForAllPlots()
|
||||
{
|
||||
for (size_t i = 0; i < m_graphPlots.size(); i++)
|
||||
{
|
||||
if (!dockWidgetFromPlot(m_graphPlots[i]))
|
||||
{
|
||||
createPlotDockWidget(m_graphPlots[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDockWidget* RimMainPlotCollection::dockWidgetFromPlot(RimSummaryPlot* graphPlot)
|
||||
void RimMainPlotCollection::updateCurrentTimeStepInPlots()
|
||||
{
|
||||
foreach(QDockWidget* dockW, m_plotViewDockWidgets)
|
||||
{
|
||||
if (dockW && dockW->widget() == graphPlot->widget())
|
||||
{
|
||||
return dockW;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
m_flowPlotCollection()->defaultFlowCharacteristicsPlot()->updateCurrentTimeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::createPlotDockWidget(RimSummaryPlot* graphPlot)
|
||||
{
|
||||
assert(m_plotMainWindow != NULL);
|
||||
|
||||
QDockWidget* dockWidget = new QDockWidget(QString("Plot Widget Tree (%1)").arg(m_plotViewDockWidgets.size() + 1), m_plotMainWindow);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
// dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
QWidget* widget = graphPlot->createPlotWidget(m_plotMainWindow);
|
||||
|
||||
dockWidget->setWidget(widget);
|
||||
|
||||
m_plotMainWindow->addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||
|
||||
m_plotViewDockWidgets.push_back(dockWidget);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::eraseDockWidget(RimSummaryPlot* graphPlot)
|
||||
{
|
||||
QDockWidget* dockW = dockWidgetFromPlot(graphPlot);
|
||||
if (dockW)
|
||||
{
|
||||
m_plotMainWindow->removeDockWidget(dockW);
|
||||
dockW->setWidget(NULL);
|
||||
dockW->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::redrawAllPlots()
|
||||
{
|
||||
for (size_t i = 0; i < m_graphPlots.size(); i++)
|
||||
{
|
||||
m_graphPlots[i]->redrawAllCurves();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QMainWindow* RimMainPlotCollection::windowWithGraphPlots()
|
||||
{
|
||||
return m_plotMainWindow;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::initAfterRead()
|
||||
{
|
||||
if (show())
|
||||
{
|
||||
showPlotWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
hidePlotWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::hidePlotWindow()
|
||||
{
|
||||
if (m_plotManagerMainWindow)
|
||||
{
|
||||
m_plotManagerMainWindow->hide();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user