mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1404 Added plot object picker, and use from Well Allocation plot
This commit is contained in:
parent
6f5d451c66
commit
947845e7fd
@ -513,6 +513,14 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
|
||||
return m_totalWellAllocationPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimWellAllocationPlot::plotLegend()
|
||||
{
|
||||
return m_wellAllocationPlotLegend;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
|
||||
RimWellLogPlot* accumulatedWellFlowPlot();
|
||||
RimTotalWellAllocationPlot* totalWellFlowPlot();
|
||||
caf::PdmObject* plotLegend();
|
||||
RimFlowDiagSolution* flowDiagSolution();
|
||||
int timeStep();
|
||||
|
||||
|
@ -46,6 +46,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuFlowCharacteristicsPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuMessagePanel.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuPlotObjectPicker.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -89,6 +90,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuFlowCharacteristicsPlot.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuMessagePanel.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuPlotObjectPicker.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
59
ApplicationCode/UserInterface/RiuPlotObjectPicker.cpp
Normal file
59
ApplicationCode/UserInterface/RiuPlotObjectPicker.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiuPlotObjectPicker.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPlotObjectPicker::RiuPlotObjectPicker(QWidget* widget, caf::PdmObject* associatedObject) :
|
||||
QObject(widget),
|
||||
m_associatedObject(associatedObject)
|
||||
{
|
||||
widget->installEventFilter(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuPlotObjectPicker::eventFilter(QObject* watchedObject, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonRelease)
|
||||
{
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>(event);
|
||||
if (me->button() == Qt::LeftButton)
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (mainPlotWindow && m_associatedObject.notNull())
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem(m_associatedObject);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// standard event processing
|
||||
return QObject::eventFilter(watchedObject, event);
|
||||
}
|
||||
|
48
ApplicationCode/UserInterface/RiuPlotObjectPicker.h
Normal file
48
ApplicationCode/UserInterface/RiuPlotObjectPicker.h
Normal file
@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmPointer.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace caf {
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
class QEvent;
|
||||
class QWidget;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiuPlotObjectPicker : public QObject
|
||||
{
|
||||
public:
|
||||
explicit RiuPlotObjectPicker(QWidget* widget, caf::PdmObject* associatedObject);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<caf::PdmObject> m_associatedObject;
|
||||
};
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuNightchartsWidget.h"
|
||||
#include "RiuPlotObjectPicker.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
@ -52,6 +53,7 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
||||
this->layout()->setSpacing(2);
|
||||
|
||||
m_titleLabel = new QLabel(this);
|
||||
new RiuPlotObjectPicker(m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot());
|
||||
|
||||
QFont font = m_titleLabel->font();
|
||||
font.setPointSize(14);
|
||||
@ -73,14 +75,19 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
||||
plotWidgetsLayout->addLayout(rightColumnLayout);
|
||||
|
||||
m_legendWidget = new RiuNightchartsWidget(this);
|
||||
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
|
||||
|
||||
rightColumnLayout->addWidget(m_legendWidget);
|
||||
m_legendWidget->showPie(false);
|
||||
|
||||
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
|
||||
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot());
|
||||
|
||||
rightColumnLayout->addWidget(totalFlowAllocationWidget);
|
||||
rightColumnLayout->addStretch();
|
||||
|
||||
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
|
||||
|
||||
plotWidgetsLayout->addWidget(wellFlowWidget);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user