mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1174 Added context menu to WellAllocationPlot and added feature
This commit is contained in:
parent
9aa98a3895
commit
45f3240932
@ -6,12 +6,14 @@ endif()
|
|||||||
|
|
||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature
|
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -0,0 +1,90 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicShowContributingWellsFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimDefines.h"
|
||||||
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimEclipseWell.h"
|
||||||
|
#include "RimEclipseWellCollection.h"
|
||||||
|
#include "RimWellAllocationPlot.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicShowContributingWellsFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||||
|
if (!wellAllocationPlot) return false;
|
||||||
|
|
||||||
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||||
|
if (!activeView) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||||
|
if (!wellAllocationPlot) return;
|
||||||
|
|
||||||
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||||
|
|
||||||
|
if (activeView)
|
||||||
|
{
|
||||||
|
activeView->cellResult->setResultType(RimDefines::FLOW_DIAGNOSTICS);
|
||||||
|
activeView->cellResult->setResultVariable("MaxFractionTracer");
|
||||||
|
activeView->cellResult->updateConnectedEditors();
|
||||||
|
|
||||||
|
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
|
||||||
|
|
||||||
|
for (RimEclipseWell* well : activeView->wellCollection()->wells())
|
||||||
|
{
|
||||||
|
if (std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|
||||||
|
|| wellAllocationPlot->wellName() == well->name())
|
||||||
|
{
|
||||||
|
well->showWell = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
well->showWell = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicShowContributingWellsFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
//actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||||
|
actionToSetup->setText("Show Contributing Wells");
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafCmdFeature.h"
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicShowContributingWellsFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled() override;
|
||||||
|
virtual void onActionTriggered( bool isChecked ) override;
|
||||||
|
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -221,6 +221,12 @@ void RimWellAllocationPlot::updateFromWell()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_contributingTracerNames.clear();
|
||||||
|
if (wfCalculator)
|
||||||
|
{
|
||||||
|
m_contributingTracerNames = wfCalculator->tracerNames();
|
||||||
|
}
|
||||||
|
|
||||||
// Create tracks and curves from the calculated data
|
// Create tracks and curves from the calculated data
|
||||||
|
|
||||||
size_t branchCount = pipeBranchesCLCoords.size();
|
size_t branchCount = pipeBranchesCLCoords.size();
|
||||||
@ -540,6 +546,14 @@ QString RimWellAllocationPlot::wellName() const
|
|||||||
return m_wellName();
|
return m_wellName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::vector<QString> RimWellAllocationPlot::contributingTracerNames() const
|
||||||
|
{
|
||||||
|
return m_contributingTracerNames;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
QString wellName() const;
|
QString wellName() const;
|
||||||
|
const std::vector<QString> contributingTracerNames() const;
|
||||||
|
|
||||||
void removeFromMdiAreaAndDeleteViewWidget();
|
void removeFromMdiAreaAndDeleteViewWidget();
|
||||||
|
|
||||||
@ -112,4 +113,5 @@ private:
|
|||||||
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
|
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
|
||||||
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
|
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
|
||||||
|
|
||||||
|
std::vector<QString> m_contributingTracerNames;
|
||||||
};
|
};
|
||||||
|
@ -20,15 +20,20 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimContextCommandBuilder.h"
|
||||||
|
#include "RimTotalWellAllocationPlot.h"
|
||||||
#include "RimWellAllocationPlot.h"
|
#include "RimWellAllocationPlot.h"
|
||||||
#include "RimWellLogPlot.h"
|
#include "RimWellLogPlot.h"
|
||||||
#include "RimWellLogTrack.h"
|
#include "RimWellLogTrack.h"
|
||||||
#include "RimTotalWellAllocationPlot.h"
|
|
||||||
|
#include "RiuNightchartsWidget.h"
|
||||||
|
|
||||||
|
#include "cvfColor3.h"
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QContextMenuEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "RiuNightchartsWidget.h"
|
#include <QMenu>
|
||||||
#include "cvfColor3.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -157,6 +162,24 @@ QSize RiuWellAllocationPlot::minimumSizeHint() const
|
|||||||
return QSize(0, 100);
|
return QSize(0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||||
|
{
|
||||||
|
QMenu menu;
|
||||||
|
QStringList commandIds;
|
||||||
|
|
||||||
|
commandIds << "RicShowContributingWellsFeature";
|
||||||
|
|
||||||
|
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||||
|
|
||||||
|
if (menu.actions().size() > 0)
|
||||||
|
{
|
||||||
|
menu.exec(event->globalPos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,6 +57,8 @@ protected:
|
|||||||
virtual QSize sizeHint() const override;
|
virtual QSize sizeHint() const override;
|
||||||
virtual QSize minimumSizeHint() const override;
|
virtual QSize minimumSizeHint() const override;
|
||||||
|
|
||||||
|
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setDefaults();
|
void setDefaults();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user