2017-01-23 08:51:50 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2017-01-23 08:51:50 +01:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2017-01-23 08:51:50 +01:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-01-23 08:51:50 +01:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "RimTotalWellAllocationPlot.h"
|
|
|
|
|
|
2020-05-09 11:23:58 +02:00
|
|
|
#include "RiaPreferences.h"
|
|
|
|
|
|
2017-01-23 08:51:50 +01:00
|
|
|
#include "RimEclipseView.h"
|
2017-10-13 14:20:47 +02:00
|
|
|
#include "RimSimWellInViewCollection.h"
|
2017-01-23 08:51:50 +01:00
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
#include "RigSimWellData.h"
|
2017-01-23 08:51:50 +01:00
|
|
|
|
2019-10-18 15:32:20 +02:00
|
|
|
#include "RimProject.h"
|
2017-01-23 08:51:50 +01:00
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
|
#include "RimWellLogTrack.h"
|
|
|
|
|
|
|
|
|
|
#include "RiuNightchartsWidget.h"
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2017-01-23 08:51:50 +01:00
|
|
|
#include "RiuWellAllocationPlot.h"
|
2017-02-02 12:10:14 +01:00
|
|
|
|
2017-02-02 11:22:02 +01:00
|
|
|
#include "cvfColor3.h"
|
2017-01-23 08:51:50 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_PDM_SOURCE_INIT( RimTotalWellAllocationPlot, "TotalWellAllocationPlot" );
|
2017-01-23 08:51:50 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
|
|
|
|
|
{
|
2022-01-07 08:31:52 +01:00
|
|
|
CAF_PDM_InitObject( "Total Allocation", ":/WellAllocPie16x16.png" );
|
2017-01-23 08:51:50 +01:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Total Allocation" ), "Name" );
|
2019-09-06 10:40:57 +02:00
|
|
|
m_userName.uiCapability()->setUiReadOnly( true );
|
2017-01-23 08:51:50 +01:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title" );
|
2017-01-23 08:51:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
|
|
|
|
{
|
|
|
|
|
removeMdiWindowFromMdiArea();
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2019-11-07 08:48:11 +01:00
|
|
|
if ( m_wellTotalAllocationPlotWidget )
|
|
|
|
|
{
|
2019-12-04 09:13:54 +01:00
|
|
|
m_wellTotalAllocationPlotWidget->hide();
|
|
|
|
|
m_wellTotalAllocationPlotWidget->setParent( nullptr );
|
|
|
|
|
delete m_wellTotalAllocationPlotWidget;
|
2019-11-07 08:48:11 +01:00
|
|
|
m_wellTotalAllocationPlotWidget = nullptr;
|
|
|
|
|
}
|
2017-01-23 08:51:50 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-14 20:48:11 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// TODO: implement properly
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
int RimTotalWellAllocationPlot::id() const
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimTotalWellAllocationPlot::deleteViewWidget()
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( m_wellTotalAllocationPlotWidget )
|
2017-01-23 08:51:50 +01:00
|
|
|
{
|
2019-12-04 09:13:54 +01:00
|
|
|
m_wellTotalAllocationPlotWidget->hide();
|
|
|
|
|
m_wellTotalAllocationPlotWidget->setParent( nullptr );
|
|
|
|
|
delete m_wellTotalAllocationPlotWidget;
|
2019-09-06 10:40:57 +02:00
|
|
|
m_wellTotalAllocationPlotWidget = nullptr;
|
2017-01-23 08:51:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-09 11:23:58 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
int RimTotalWellAllocationPlot::fontSize() const
|
|
|
|
|
{
|
2020-06-08 09:09:11 +00:00
|
|
|
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize() );
|
2020-05-09 11:23:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimTotalWellAllocationPlot::updateFonts()
|
2020-06-08 09:09:11 +00:00
|
|
|
{
|
2020-05-09 11:23:58 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
QWidget* RimTotalWellAllocationPlot::viewWidget()
|
|
|
|
|
{
|
|
|
|
|
return m_wellTotalAllocationPlotWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
void RimTotalWellAllocationPlot::zoomAll()
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-01-23 08:51:50 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 10:48:40 +01:00
|
|
|
void RimTotalWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
2017-01-23 08:51:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
2017-01-23 08:51:50 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( changedField == &m_userName || changedField == &m_showPlotTitle )
|
2017-01-23 08:51:50 +01:00
|
|
|
{
|
|
|
|
|
updateMdiWindowTitle();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-14 20:48:11 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// TODO: Implement properly
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
void RimTotalWellAllocationPlot::assignIdIfNecessary()
|
|
|
|
|
{
|
|
|
|
|
}
|
2019-11-14 20:48:11 +01:00
|
|
|
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
QImage RimTotalWellAllocationPlot::snapshotWindowContent()
|
|
|
|
|
{
|
|
|
|
|
QImage image;
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
|
|
return image;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimTotalWellAllocationPlot::setDescription( const QString& description )
|
2017-01-23 08:51:50 +01:00
|
|
|
{
|
|
|
|
|
m_userName = description;
|
2023-08-04 09:04:14 +02:00
|
|
|
updateMdiWindowTitle();
|
2017-01-23 08:51:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
QString RimTotalWellAllocationPlot::description() const
|
|
|
|
|
{
|
|
|
|
|
return m_userName();
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-19 13:44:08 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-04-19 13:44:08 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
QString RimTotalWellAllocationPlot::totalAllocationAsText() const
|
|
|
|
|
{
|
|
|
|
|
QString txt;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( auto a : m_sliceInfo )
|
2017-04-19 13:44:08 +02:00
|
|
|
{
|
|
|
|
|
txt += a.first;
|
|
|
|
|
txt += "\t";
|
2019-09-06 10:40:57 +02:00
|
|
|
txt += QString::number( a.second );
|
2017-04-19 13:44:08 +02:00
|
|
|
txt += "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return txt;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-02 11:22:02 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-02-02 11:22:02 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimTotalWellAllocationPlot::addSlice( const QString& name, const cvf::Color3f& color, float value )
|
2017-02-02 11:22:02 +01:00
|
|
|
{
|
2017-02-02 16:06:50 +01:00
|
|
|
if ( m_wellTotalAllocationPlotWidget )
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
|
2017-02-02 11:22:02 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
m_wellTotalAllocationPlotWidget->addItem( name, sliceColor, value );
|
2017-02-02 16:06:50 +01:00
|
|
|
m_wellTotalAllocationPlotWidget->update();
|
|
|
|
|
}
|
2017-04-19 13:44:08 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
m_sliceInfo.push_back( std::make_pair( name, value ) );
|
2017-02-02 11:22:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-02-02 11:22:02 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimTotalWellAllocationPlot::clearSlices()
|
|
|
|
|
{
|
2017-02-02 16:06:50 +01:00
|
|
|
if ( m_wellTotalAllocationPlotWidget )
|
|
|
|
|
{
|
|
|
|
|
m_wellTotalAllocationPlotWidget->clear();
|
|
|
|
|
m_wellTotalAllocationPlotWidget->update();
|
|
|
|
|
}
|
2017-04-19 13:44:08 +02:00
|
|
|
|
|
|
|
|
m_sliceInfo.clear();
|
2017-02-02 11:22:02 +01:00
|
|
|
}
|
|
|
|
|
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-10-31 12:49:14 +01:00
|
|
|
void RimTotalWellAllocationPlot::onLoadDataAndUpdate()
|
2017-01-23 08:51:50 +01:00
|
|
|
{
|
2017-02-02 16:06:50 +01:00
|
|
|
updateMdiWindowVisibility();
|
2017-01-23 08:51:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-01-23 08:51:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
QWidget* RimTotalWellAllocationPlot::createViewWidget( QWidget* mainWindowParent )
|
2017-01-23 08:51:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget( mainWindowParent );
|
|
|
|
|
m_wellTotalAllocationPlotWidget->showLegend( false );
|
2017-01-23 08:51:50 +01:00
|
|
|
return m_wellTotalAllocationPlotWidget;
|
|
|
|
|
}
|