mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make Well Allocation Plots work well again
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,11 +21,11 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimTofAccumulatedPhaseFractionsPlot.h"
|
||||
#include "RimTotalWellAllocationPlot.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimTofAccumulatedPhaseFractionsPlot.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuNightchartsWidget.h"
|
||||
@@ -38,106 +38,181 @@
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent )
|
||||
: RiuWellLogPlot( plotDefinition, parent )
|
||||
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
|
||||
: QFrame(parent)
|
||||
, m_plotDefinition(plotDefinition)
|
||||
{
|
||||
Q_ASSERT( m_plotDefinition );
|
||||
Q_ASSERT(m_plotDefinition);
|
||||
|
||||
auto leftColumnLayout = new QVBoxLayout();
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout();
|
||||
this->setLayout(mainLayout);
|
||||
this->layout()->setMargin(0);
|
||||
this->layout()->setSpacing(2);
|
||||
|
||||
m_plotLayout->insertLayout( 0, leftColumnLayout );
|
||||
m_titleLabel = new QLabel(this);
|
||||
new RiuPlotObjectPicker(m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot());
|
||||
|
||||
m_legendWidget = new RiuNightchartsWidget( this );
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>( m_plotDefinition.p() );
|
||||
new RiuPlotObjectPicker( m_legendWidget, wellAllocationPlot->plotLegend() );
|
||||
QFont font = m_titleLabel->font();
|
||||
font.setPointSize(14);
|
||||
font.setBold(true);
|
||||
m_titleLabel->setFont(font);
|
||||
|
||||
// White background
|
||||
QPalette pal = this->palette();
|
||||
pal.setColor(QPalette::Background, Qt::white);
|
||||
this->setAutoFillBackground(true);
|
||||
this->setPalette(pal);
|
||||
|
||||
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter);
|
||||
|
||||
auto plotWidgetsLayout = new QHBoxLayout();
|
||||
auto rightColumnLayout = new QVBoxLayout();
|
||||
|
||||
mainLayout->addLayout(plotWidgetsLayout);
|
||||
plotWidgetsLayout->addLayout(rightColumnLayout);
|
||||
|
||||
m_legendWidget = new RiuNightchartsWidget(this);
|
||||
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
|
||||
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
new RiuContextMenuLauncher( m_legendWidget, menuBuilder );
|
||||
new RiuContextMenuLauncher(m_legendWidget, menuBuilder);
|
||||
|
||||
leftColumnLayout->addWidget( m_legendWidget );
|
||||
m_legendWidget->showPie( false );
|
||||
rightColumnLayout->addWidget(m_legendWidget);
|
||||
m_legendWidget->showPie(false);
|
||||
|
||||
QWidget* totalFlowAllocationWidget = wellAllocationPlot->totalWellFlowPlot()->createViewWidget( nullptr );
|
||||
new RiuPlotObjectPicker( totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot() );
|
||||
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
|
||||
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
|
||||
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot());
|
||||
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder);
|
||||
|
||||
leftColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
|
||||
leftColumnLayout->addWidget( wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget( nullptr ),
|
||||
Qt::AlignTop );
|
||||
leftColumnLayout->addStretch();
|
||||
this->update();
|
||||
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop);
|
||||
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
|
||||
rightColumnLayout->addStretch();
|
||||
|
||||
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget();
|
||||
|
||||
plotWidgetsLayout->addWidget(wellFlowWidget);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellAllocationPlot::~RiuWellAllocationPlot() {}
|
||||
RiuWellAllocationPlot::~RiuWellAllocationPlot()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::showLegend( bool doShow )
|
||||
RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
|
||||
{
|
||||
if ( doShow )
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiuWellAllocationPlot::ownerViewWindow() const
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::showTitle(const QString& title)
|
||||
{
|
||||
m_titleLabel->show();
|
||||
|
||||
m_titleLabel->setText(title);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::hideTitle()
|
||||
{
|
||||
m_titleLabel->hide();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::showLegend(bool doShow)
|
||||
{
|
||||
if (doShow)
|
||||
m_legendWidget->show();
|
||||
else
|
||||
m_legendWidget->hide();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::addLegendItem( const QString& name, const cvf::Color3f& color, float value )
|
||||
{
|
||||
QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
|
||||
|
||||
m_legendWidget->addItem( name, sliceColor, value );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::addLegendItem(const QString& name, const cvf::Color3f& color, float value)
|
||||
{
|
||||
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
|
||||
|
||||
m_legendWidget->addItem(name, sliceColor, value);
|
||||
m_legendWidget->updateGeometry();
|
||||
m_legendWidget->update();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::clearLegend()
|
||||
{
|
||||
m_legendWidget->clear();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuWellAllocationPlot::minimumSizeHint() const
|
||||
{
|
||||
return QSize( 0, 100 );
|
||||
return QSize(0, 100);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
|
||||
menuBuilder.appendToMenu( &menu );
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if ( menu.actions().size() > 0 )
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
menu.exec( event->globalPos() );
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuWellAllocationPlot::sizeHint() const
|
||||
{
|
||||
return QSize( 0, 0 );
|
||||
return QSize(0, 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::setDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -1,40 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QPointer>
|
||||
#include <QFrame>
|
||||
|
||||
#include "RiuInterfaceToViewWindow.h"
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
class RiuNightchartsWidget;
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
namespace cvf {
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -42,24 +41,34 @@ class Color3f;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuWellAllocationPlot : public RiuWellLogPlot
|
||||
class RiuWellAllocationPlot : public QFrame, public RiuInterfaceToViewWindow
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr );
|
||||
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr);
|
||||
~RiuWellAllocationPlot() override;
|
||||
|
||||
void showLegend( bool doShow );
|
||||
void addLegendItem( const QString& name, const cvf::Color3f& color, float value );
|
||||
void clearLegend();
|
||||
RimWellAllocationPlot* ownerPlotDefinition();
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
|
||||
void showTitle(const QString& title);
|
||||
void hideTitle();
|
||||
void showLegend(bool doShow);
|
||||
void addLegendItem(const QString& name, const cvf::Color3f& color, float value);
|
||||
void clearLegend();
|
||||
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
void contextMenuEvent(QContextMenuEvent *) override;
|
||||
|
||||
private:
|
||||
void setDefaults();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
|
||||
QPointer<RiuNightchartsWidget> m_legendWidget;
|
||||
QPointer<QLabel> m_titleLabel;
|
||||
};
|
||||
|
Reference in New Issue
Block a user