#2020 Move LAS files. Support for submenus and command features with custom name and user data

This commit is contained in:
Bjørn Erik Jensen
2017-11-19 01:12:39 +01:00
parent f032a3eb9f
commit 31a84181e6
25 changed files with 920 additions and 457 deletions

View File

@@ -31,9 +31,9 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuContextMenuLauncher::RiuContextMenuLauncher(QWidget* widget, const QStringList& commandIds) :
RiuContextMenuLauncher::RiuContextMenuLauncher(QWidget* widget, const caf::CmdFeatureMenuBuilder& commandIds) :
QObject(widget),
m_commandIds(commandIds)
m_menuBuilder(commandIds)
{
widget->installEventFilter(this);
}
@@ -46,7 +46,7 @@ bool RiuContextMenuLauncher::eventFilter(QObject* watchedObject, QEvent* event)
if (event->type() == QEvent::ContextMenu)
{
QMenu menu;
RimContextCommandBuilder::appendCommandsToMenu(m_commandIds, &menu);
m_menuBuilder.appendToMenu(&menu);
if (menu.actions().size() > 0)
{

View File

@@ -18,6 +18,7 @@
#pragma once
#include "cafCmdFeatureMenuBuilder.h"
#include <QObject>
#include <QStringList>
@@ -32,12 +33,12 @@ class QWidget;
class RiuContextMenuLauncher : public QObject
{
public:
explicit RiuContextMenuLauncher(QWidget* widget, const QStringList& commandIds);
explicit RiuContextMenuLauncher(QWidget* widget, const caf::CmdFeatureMenuBuilder& commandIds);
protected:
bool eventFilter(QObject* watched, QEvent* event) override;
private:
QStringList m_commandIds;
caf::CmdFeatureMenuBuilder m_menuBuilder;
};

View File

@@ -25,6 +25,8 @@
#include "RiuLineSegmentQwtPlotCurve.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cvfBase.h"
#include "cvfAssert.h"
#include "cvfColor3.h"
@@ -130,11 +132,11 @@ QSize RiuResultQwtPlot::minimumSizeHint() const
void RiuResultQwtPlot::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
QStringList commandIds;
caf::CmdFeatureMenuBuilder menuBuilder;
commandIds << "RicNewGridTimeHistoryCurveFeature";
menuBuilder << "RicNewGridTimeHistoryCurveFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
menuBuilder.appendToMenu(&menu);
if (menu.actions().size() > 0)
{

View File

@@ -32,6 +32,7 @@
#include "RiuQwtScalePicker.h"
#include "cafSelectionManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "qwt_date_scale_draw.h"
#include "qwt_date_scale_engine.h"
@@ -166,13 +167,13 @@ QSize RiuSummaryQwtPlot::minimumSizeHint() const
void RiuSummaryQwtPlot::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
QStringList commandIds;
caf::CmdFeatureMenuBuilder menuBuilder;
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
commandIds << "RicShowPlotDataFeature";
menuBuilder << "RicShowPlotDataFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
menuBuilder.appendToMenu(&menu);
if (menu.actions().size() > 0)
{

View File

@@ -73,6 +73,7 @@
#include "cafCmdFeatureManager.h"
#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cvfDrawableGeo.h"
#include "cvfHitItemCollection.h"
@@ -279,7 +280,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
}
}
QStringList commandIds;
caf::CmdFeatureMenuBuilder menuBuilder;
// Well log curve creation commands
if (firstHitPart && firstHitPart->sourceInfo())
@@ -297,21 +298,21 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
commandIds << "RicNewWellPathFractureAtPosFeature";
menuBuilder << "RicNewWellPathFractureAtPosFeature";
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
//TODO: Update so these also use RiuWellPathSelectionItem
caf::SelectionManager::instance()->setSelectedItem(wellPath);
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewWellLogFileCurveFeature";
commandIds << "RicNewRftPlotFeature";
commandIds << "RicNewPltPlotFeature";
commandIds << "Separator";
commandIds << "RicNewWellPathIntersectionFeature";
commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature";
commandIds << "RicNewPerforationIntervalAtMeasuredDepthFeature";
menuBuilder << "RicNewWellLogCurveExtractionFeature";
menuBuilder << "RicNewWellLogFileCurveFeature";
menuBuilder << "RicNewRftPlotFeature";
menuBuilder << "RicNewPltPlotFeature";
menuBuilder << "Separator";
menuBuilder << "RicNewWellPathIntersectionFeature";
menuBuilder << "RicNewFishbonesSubsAtMeasuredDepthFeature";
menuBuilder << "RicNewPerforationIntervalAtMeasuredDepthFeature";
}
}
@@ -326,19 +327,19 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewWellLogRftCurveFeature";
commandIds << "RicNewRftPlotFeature";
commandIds << "RicNewPltPlotFeature";
commandIds << "RicShowWellAllocationPlotFeature";
commandIds << "RicPlotProductionRateFeature";
commandIds << "Separator";
commandIds << "RicShowContributingWellsFeature";
commandIds << "Separator";
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicPlotProductionRateFeature";
menuBuilder << "RicNewWellLogCurveExtractionFeature";
menuBuilder << "RicNewWellLogRftCurveFeature";
menuBuilder << "RicNewRftPlotFeature";
menuBuilder << "RicNewPltPlotFeature";
menuBuilder << "RicShowWellAllocationPlotFeature";
menuBuilder << "RicPlotProductionRateFeature";
menuBuilder << "Separator";
menuBuilder << "RicShowContributingWellsFeature";
menuBuilder << "Separator";
menuBuilder << "RicNewSimWellIntersectionFeature";
menuBuilder << "RicPlotProductionRateFeature";
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
commandIds << "RicNewSimWellFractureAtPosFeature";
menuBuilder << "RicNewSimWellFractureAtPosFeature";
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
}
}
@@ -348,19 +349,19 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
// View Link commands
if (!firstHitPart)
{
commandIds << "RicLinkViewFeature";
commandIds << "RicShowLinkOptionsFeature";
commandIds << "RicSetMasterViewFeature";
commandIds << "RicUnLinkViewFeature";
menuBuilder << "RicLinkViewFeature";
menuBuilder << "RicShowLinkOptionsFeature";
menuBuilder << "RicSetMasterViewFeature";
menuBuilder << "RicUnLinkViewFeature";
}
commandIds << "Separator";
commandIds << "RicNewGridTimeHistoryCurveFeature";
commandIds << "RicShowFlowCharacteristicsPlotFeature";
commandIds << "RicSaveEclipseInputVisibleCellsFeature";
commandIds << "RicShowGridStatisticsFeature";
menuBuilder << "Separator";
menuBuilder << "RicNewGridTimeHistoryCurveFeature";
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
menuBuilder << "RicShowGridStatisticsFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
menuBuilder.appendToMenu(&menu);
if (!menu.isEmpty())
{

View File

@@ -79,16 +79,16 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
m_legendWidget = new RiuNightchartsWidget(this);
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
QStringList commandIds;
commandIds << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher(m_legendWidget, commandIds);
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher(m_legendWidget, menuBuilder);
rightColumnLayout->addWidget(m_legendWidget);
m_legendWidget->showPie(false);
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot());
new RiuContextMenuLauncher(totalFlowAllocationWidget, commandIds);
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder);
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop);
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
@@ -193,11 +193,11 @@ QSize RiuWellAllocationPlot::minimumSizeHint() const
void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
QStringList commandIds;
caf::CmdFeatureMenuBuilder menuBuilder;
commandIds << "RicShowContributingWellsFromPlotFeature";
menuBuilder << "RicShowContributingWellsFromPlotFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
menuBuilder.appendToMenu(&menu);
if (menu.actions().size() > 0)
{

View File

@@ -27,6 +27,7 @@
#include "RiuWellLogTrack.h"
#include "cafSelectionManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cvfAssert.h"
@@ -214,14 +215,14 @@ QSize RiuWellLogPlot::sizeHint() const
void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
QStringList commandIds;
caf::CmdFeatureMenuBuilder menuBuilder;
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
commandIds << "RicShowPlotDataFeature";
commandIds << "RicShowContributingWellsFromPlotFeature";
menuBuilder << "RicShowPlotDataFeature";
menuBuilder << "RicShowContributingWellsFromPlotFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
menuBuilder.appendToMenu(&menu);
if (menu.actions().size() > 0)
{