///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RimContextCommandBuilder.h" #include "RiaApplication.h" #include "PlotTemplates/RimPlotTemplateFileItem.h" #include "PlotTemplates/RimPlotTemplateFolderItem.h" #include "Rim3dOverlayInfoConfig.h" #include "Rim3dWellLogCurveCollection.h" #include "Rim3dWellLogExtractionCurve.h" #include "Rim3dWellLogFileCurve.h" #include "Rim3dWellLogRftCurve.h" #include "RimAnalysisPlot.h" #include "RimAnalysisPlotCollection.h" #include "RimAnnotationCollection.h" #include "RimAnnotationGroupCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimBoxIntersection.h" #include "RimCalcScript.h" #include "RimCaseCollection.h" #include "RimCellEdgeColors.h" #include "RimCellFilterCollection.h" #include "RimCellRangeFilter.h" #include "RimColorLegend.h" #include "RimColorLegendCollection.h" #include "RimColorLegendItem.h" #include "RimCorrelationMatrixPlot.h" #include "RimCorrelationPlot.h" #include "RimCorrelationPlotCollection.h" #include "RimCustomObjectiveFunction.h" #include "RimCustomObjectiveFunctionCollection.h" #include "RimEclipseCase.h" #include "RimEclipseCaseCollection.h" #include "RimEclipseCellColors.h" #include "RimEclipseContourMapView.h" #include "RimEclipseContourMapViewCollection.h" #include "RimEclipseFaultColors.h" #include "RimEclipseInputProperty.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipsePropertyFilterCollection.h" #include "RimEclipseResultCase.h" #include "RimEclipseStatisticsCase.h" #include "RimEclipseView.h" #include "RimElasticProperties.h" #include "RimEllipseFractureTemplate.h" #include "RimEnsembleCurveFilterCollection.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimEnsembleFractureStatisticsCollection.h" #include "RimExtrudedCurveIntersection.h" #include "RimFaultInView.h" #include "RimFaultInViewCollection.h" #include "RimFishbones.h" #include "RimFishbonesCollection.h" #include "RimFlowCharacteristicsPlot.h" #include "RimFlowDiagSolution.h" #include "RimFlowPlotCollection.h" #include "RimFormationNames.h" #include "RimFormationNamesCollection.h" #include "RimFractureTemplate.h" #include "RimFractureTemplateCollection.h" #include "RimGeoMechCase.h" #include "RimGeoMechCellColors.h" #include "RimGeoMechContourMapView.h" #include "RimGeoMechContourMapViewCollection.h" #include "RimGeoMechPropertyFilter.h" #include "RimGeoMechPropertyFilterCollection.h" #include "RimGeoMechView.h" #include "RimGridCaseSurface.h" #include "RimGridCollection.h" #include "RimGridCrossPlot.h" #include "RimGridCrossPlotCollection.h" #include "RimGridCrossPlotDataSet.h" #include "RimIdenticalGridCaseGroup.h" #include "RimIntersectionCollection.h" #include "RimIntersectionResultDefinition.h" #include "RimIntersectionResultsDefinitionCollection.h" #include "RimModeledWellPath.h" #include "RimMultiPlot.h" #include "RimMultiPlotCollection.h" #include "RimObservedSummaryData.h" #include "RimParameterResultCrossPlot.h" #include "RimPerforationCollection.h" #include "RimPerforationInterval.h" #include "RimPlotDataFilterCollection.h" #include "RimPlotDataFilterItem.h" #include "RimPltPlotCollection.h" #include "RimPressureTable.h" #include "RimProject.h" #include "RimRftPlotCollection.h" #include "RimSaturationPressurePlotCollection.h" #include "RimScriptCollection.h" #include "RimSimWellFracture.h" #include "RimSimWellInView.h" #include "RimSimWellInViewCollection.h" #include "RimStimPlanFractureTemplate.h" #include "RimStimPlanModel.h" #include "RimStimPlanModelCollection.h" #include "RimStimPlanModelPlot.h" #include "RimStimPlanModelTemplate.h" #include "RimStimPlanModelTemplateCollection.h" #include "RimStreamlineInViewCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSurface.h" #include "RimSurfaceCollection.h" #include "RimValveTemplate.h" #include "RimValveTemplateCollection.h" #include "RimVfpPlotCollection.h" #include "RimViewController.h" #include "RimViewLinker.h" #include "RimViewLinkerCollection.h" #include "RimVirtualPerforationResults.h" #include "RimWellAllocationPlot.h" #include "RimWellLogCurve.h" #include "RimWellLogFile.h" #include "RimWellLogFileChannel.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" #include "RimWellLogTrack.h" #include "RimWellMeasurementCollection.h" #include "RimWellMeasurementFilePath.h" #include "RimWellPath.h" #include "RimWellPathAttributeCollection.h" #include "RimWellPathCollection.h" #include "RimWellPathCompletions.h" #include "RimWellPathFracture.h" #include "RimWellPathFractureCollection.h" #include "RimWellPltPlot.h" #ifdef USE_QTCHARTS #include "RimEnsembleFractureStatisticsPlotCollection.h" #include "RimGridStatisticsPlotCollection.h" #endif #include "RiuMainWindow.h" #include "OctaveScriptCommands/RicExecuteScriptForCasesFeature.h" #include "ToggleCommands/RicToggleItemsFeatureImpl.h" #include "cafCmdFeature.h" #include "cafCmdFeatureManager.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmUiItem.h" #include "cafSelectionManager.h" #include "cafSelectionManagerTools.h" #include "cafTreeNode.h" #include "cvfAssert.h" #include #include #include #include #include #include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { std::vector uiItems; caf::SelectionManager::instance()->selectedItems( uiItems ); caf::PdmUiItem* firstUiItem = nullptr; { if ( !uiItems.empty() ) { firstUiItem = uiItems[0]; } } if ( dynamic_cast( firstUiItem ) ) return {}; caf::CmdFeatureMenuBuilder menuBuilder; if ( uiItems.size() == 1 ) { if ( dynamic_cast( firstUiItem ) ) { menuBuilder.subMenuStart( "Import" ); menuBuilder << "RicImportEclipseCaseFeature"; menuBuilder << "RicImportEclipseCasesFeature"; menuBuilder << "RicImportInputEclipseCaseFeature"; menuBuilder << "RicCreateGridCaseGroupFromFilesFeature"; menuBuilder.subMenuEnd(); menuBuilder << "RicEclipseCaseNewGroupFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteGeoMechViewsFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewViewFeature"; menuBuilder << "RicNewContourMapViewFeature"; menuBuilder << "Separator"; menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "RicExportContourMapToTextFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteEclipseViewsFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewViewFeature"; menuBuilder << "RicNewContourMapViewFeature"; menuBuilder << "RicCreateGridCrossPlotFeature"; menuBuilder << "RicCreateSaturationPressurePlotsFeature"; menuBuilder << "Separator"; menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "RicExportEclipseInputGridFeature"; menuBuilder << "RicSaveEclipseResultAsInputPropertyFeature"; menuBuilder << "RicExportContourMapToTextFeature"; menuBuilder << "RicSaveEclipseInputVisibleCellsFeature"; menuBuilder << "RicAddEclipseInputPropertyFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewContourMapViewFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewContourMapViewFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteEclipseCasesFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewStatisticsCaseFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewViewFeature"; menuBuilder << "RicComputeStatisticsFeature"; menuBuilder << "Separator"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteEclipseCasesFeature"; menuBuilder << "RicPasteEclipseViewsFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewViewFeature"; menuBuilder << "RicNewContourMapViewFeature"; menuBuilder << "RicShowFlowCharacteristicsPlotFeature"; menuBuilder << "RicEclipseCaseNewGroupFeature"; menuBuilder << "Separator"; menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "Separator"; #ifdef USE_ODB_API if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewFaultReactAssessmentFeature"; menuBuilder << "Separator"; } #endif } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportCompletionsForTemporaryLgrsFeature"; menuBuilder << "RicDeleteTemporaryLgrsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteGeoMechViewsFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewViewFeature"; menuBuilder << "RicNewContourMapViewFeature"; menuBuilder << "Separator"; menuBuilder << "RicImportElementPropertyFeature"; menuBuilder << "Separator"; menuBuilder << "RicGeoMechCopyCaseFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewFaultReactAssessmentFeature"; menuBuilder << "Separator"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteEclipseCasesFeature"; menuBuilder << "Separator"; menuBuilder << "RicEclipseCaseNewGroupFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicSaveEclipseResultAsInputPropertyFeature"; menuBuilder << "RicExportEclipseInputGridFeature"; menuBuilder << "RicSaveEclipseInputVisibleCellsFeature"; menuBuilder << "RicCreateGridCrossPlotFeature"; menuBuilder << "RicAddEclipseInputPropertyFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicSaveEclipseInputPropertyFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicEclipsePropertyFilterNewFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicEclipsePropertyFilterInsertFeature"; menuBuilder << "RicApplyPropertyFilterAsCellResultFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicGeoMechPropertyFilterNewFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicGeoMechPropertyFilterInsertFeature"; menuBuilder << "RicApplyPropertyFilterAsCellResultFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewEditableWellPathFeature"; menuBuilder.addSeparator(); menuBuilder.subMenuStart( "Import" ); menuBuilder << "RicWellPathsImportFileFeature"; menuBuilder << "RicWellPathsImportSsihubFeature"; menuBuilder << "RicWellPathFormationsImportFileFeature"; menuBuilder << "RicWellLogsImportFileFeature"; menuBuilder << "RicReloadWellPathFormationNamesFeature"; menuBuilder.addSeparator(); menuBuilder << "RicWellPathImportPerforationIntervalsFeature"; menuBuilder << "RicImportWellMeasurementsFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder.subMenuStart( "Export Well Paths", QIcon( ":/Save.svg" ) ); menuBuilder << "RicExportSelectedWellPathsFeature"; menuBuilder << "RicExportVisibleWellPathsFeature"; menuBuilder.subMenuEnd(); appendExportCompletions( menuBuilder ); } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicReloadWellMeasurementsFeature"; menuBuilder << "RicDeleteWellMeasurementFilePathFeature"; menuBuilder << "RicImportWellMeasurementsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportWellMeasurementsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewEditableWellPathFeature"; menuBuilder << "RicNewWellPathLateralFeature"; menuBuilder << "RicNewWellPathIntersectionFeature"; appendCreateCompletions( menuBuilder ); menuBuilder.addSeparator(); appendImportMenu( menuBuilder ); menuBuilder.addSeparator(); appendExportCompletions( menuBuilder ); menuBuilder.addSeparator(); appendExportWellPaths( menuBuilder ); menuBuilder.addSeparator(); menuBuilder.subMenuStart( "Well Plots", QIcon( ":/WellLogTrack16x16.png" ) ); menuBuilder << "RicNewRftPlotFeature"; menuBuilder << "RicNewPltPlotFeature"; menuBuilder << "RicShowWellAllocationPlotFeature"; menuBuilder << "RicNewWellBoreStabilityPlotFeature"; menuBuilder << "RicNewWellLogFileCurveFeature"; menuBuilder << "RicNewWellLogCurveExtractionFeature"; menuBuilder.subMenuEnd(); menuBuilder.subMenuStart( "3D Well Log Curves", QIcon( ":/WellLogCurve16x16.png" ) ); menuBuilder << "RicAdd3dWellLogCurveFeature"; menuBuilder << "RicAdd3dWellLogFileCurveFeature"; menuBuilder << "RicAdd3dWellLogRftCurveFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder.addSeparator(); if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowWellPlanFeature"; } } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder.subMenuStart( "Create Completions", QIcon( ":/CompletionsSymbol16x16.png" ) ); menuBuilder << "RicNewPerforationIntervalFeature"; menuBuilder << "RicNewFishbonesSubsFeature"; menuBuilder << "RicNewWellPathFractureFeature"; menuBuilder << "RicNewStimPlanModelFeature"; menuBuilder.subMenuEnd(); menuBuilder << "RicCreateTemporaryLgrFeature"; menuBuilder.addSeparator(); appendExportCompletions( menuBuilder ); } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewPerforationIntervalFeature"; if ( dynamic_cast( firstUiItem ) ) menuBuilder << "RicNewValveFeature"; menuBuilder.addSeparator(); menuBuilder << "RicEditPerforationCollectionFeature"; menuBuilder.addSeparator(); appendExportCompletions( menuBuilder ); } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewFishbonesSubsFeature"; appendExportCompletions( menuBuilder ); } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewWellPathFractureFeature"; appendExportCompletions( menuBuilder ); } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicDeleteWellPathAttributeFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewStimPlanModelFeature"; menuBuilder << "RicNewStimPlanModelPlotFeature"; menuBuilder << "RicExportStimPlanModelToFileFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewPressureTableItemFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewStimPlanModelFeature"; } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAdd3dWellLogCurveFeature"; menuBuilder << "RicAdd3dWellLogFileCurveFeature"; menuBuilder << "RicAdd3dWellLogRftCurveFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicWellPathsImportFileFeature"; menuBuilder << "RicWellLogsImportFileFeature"; menuBuilder << "Separator"; menuBuilder.subMenuStart( "Move LAS file to well path" ); RimWellPath* parentWellPath = caf::firstAncestorOfTypeFromSelectedObject(); QString parentWellPathName = parentWellPath ? parentWellPath->name() : ""; for ( RimWellPath* wellPath : allWellPaths() ) { if ( wellPath->name() != parentWellPathName ) { menuBuilder.addCmdFeatureWithUserData( "RicMoveWellLogFilesFeature", wellPath->name(), wellPath->name() ); } } menuBuilder.subMenuEnd(); } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicEditScriptFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewOctaveScriptFeature"; #ifdef ENABLE_GRPC menuBuilder << "RicNewPythonScriptFeature"; #endif menuBuilder << "Separator"; menuBuilder << "RicExecuteScriptFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewOctaveScriptFeature"; #ifdef ENABLE_GRPC menuBuilder << "RicNewPythonScriptFeature"; #endif menuBuilder << "Separator"; menuBuilder << "RicAddScriptPathFeature"; menuBuilder << "RicRefreshScriptsFeature"; menuBuilder << "RicExecuteLastUsedScriptFeature"; menuBuilder << "Separator"; menuBuilder << "RicDeleteScriptPathFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowAllLinkedViewsFeature"; } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowAllLinkedViewsFeature"; menuBuilder << "Separator"; menuBuilder << "RicDeleteAllLinkedViewsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteWellLogPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewWellLogPlotFeature"; menuBuilder << "RicNewWellBoreStabilityPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewRftPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewPltPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewVfpPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteSummaryPlotFeature"; menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewSummaryPlotFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewAnalysisPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewAnalysisPlotFeature"; menuBuilder << "RicNewPlotDataFilterFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewCorrelationPlotFeature"; menuBuilder << "RicNewCorrelationMatrixPlotFeature"; menuBuilder << "RicNewParameterResultCrossPlotFeature"; menuBuilder << "RicNewCorrelationReportPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewCorrelationPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewCorrelationMatrixPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewParameterResultCrossPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewPlotDataFilterFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewPlotDataFilterFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteSummaryCrossPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewSummaryCrossPlotFeature"; } else if ( dynamic_cast( firstUiItem ) && !dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteWellLogPlotFeature"; menuBuilder << "RicPasteWellLogTrackFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewWellLogPlotTrackFeature"; menuBuilder << "RicAsciiExportWellLogPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteWellLogTrackFeature"; menuBuilder << "RicPasteWellLogCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewWellLogCurveExtractionFeature"; menuBuilder << "RicNewWellLogRftCurveFeature"; menuBuilder << "RicNewWellLogFileCurveFeature"; menuBuilder << "RicNewWellMeasurementCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicDeleteSubPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteWellLogCurveFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateGridCrossPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateSaturationPressurePlotsFeature"; } #ifdef USE_QTCHARTS else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateGridStatisticsPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateEnsembleFractureStatisticsPlotFeature"; } #endif else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteGridCrossPlotDataSetFeature"; menuBuilder << "Separator"; menuBuilder << "RicCreateGridCrossPlotDataSetFeature"; menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteGridCrossPlotDataSetFeature"; menuBuilder << "Separator"; menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature"; } else if ( dynamic_cast( firstUiItem ) ) // This is also the definition for RimSummaryCrossPlot { RimSummaryCrossPlot* summaryCrossPlot = dynamic_cast( firstUiItem ); menuBuilder << "RicPasteSummaryCurveFeature"; menuBuilder << "RicPasteSummaryCrossPlotCurveFeature"; menuBuilder << "RicPasteSummaryPlotFeature"; menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature"; menuBuilder << "RicPasteEnsembleCurveSetFeature"; menuBuilder << "Separator"; menuBuilder << "RicEditSummaryPlotFeature"; menuBuilder << "RicDuplicateSummaryPlotFeature"; menuBuilder << "RicNewSummaryEnsembleCurveSetFeature"; menuBuilder << "RicDuplicateSummaryCrossPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicSavePlotTemplateFeature"; // Export is not supported for cross plot if ( !summaryCrossPlot ) menuBuilder << "RicAsciiExportSummaryPlotFeature"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; menuBuilder << "Separator"; menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "Separator"; menuBuilder << "RicViewZoomAllFeature"; menuBuilder << "Separator"; menuBuilder << "RicDeleteSubPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteSummaryCurveFeature"; menuBuilder << "RicPasteSummaryCrossPlotCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewSummaryCurveFeature"; menuBuilder << "RicDuplicateSummaryCurveFeature"; menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; menuBuilder << "RicDuplicateSummaryCrossPlotCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicSetSourceSteppingSummaryCurveFeature"; menuBuilder << "RicClearSourceSteppingSummaryCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicStackSelectedCurvesFeature"; menuBuilder << "RicUnstackSelectedCurvesFeature"; menuBuilder << "Separator"; menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "Separator"; menuBuilder << "RicEditSummaryCurveCalculationFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteSummaryCurveFeature"; menuBuilder << "RicPasteSummaryCrossPlotCurveFeature"; menuBuilder << "Separator"; menuBuilder << "RicEditSummaryPlotFeature"; menuBuilder << "RicNewSummaryCurveFeature"; menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewSummaryEnsembleCurveSetFeature"; menuBuilder << "RicPasteEnsembleCurveSetFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewSummaryEnsembleCurveSetFeature"; menuBuilder << "Separator"; menuBuilder << "RicSetSourceSteppingEnsembleCurveSetFeature"; menuBuilder << "RicClearSourceSteppingEnsembleCurveSetFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewEnsembleCurveFilterFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewCustomObjectiveFunctionFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewCustomObjectiveFunctionWeightFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewEnsembleCurveFilterFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportSummaryCaseFeature"; menuBuilder << "RicImportSummaryCasesFeature"; menuBuilder << "RicImportSummaryGroupFeature"; menuBuilder << "RicImportEnsembleFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; menuBuilder << "Separator"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder.subMenuStart( "Import" ); menuBuilder << "RicImportSummaryCaseFeature"; menuBuilder << "RicImportSummaryCasesFeature"; menuBuilder << "RicImportSummaryGroupFeature"; menuBuilder << "RicImportEnsembleFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicNewSummaryPlotFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicConvertGroupToEnsembleFeature"; menuBuilder.addSeparator(); } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder.subMenuStart( "Import" ); menuBuilder << "RicImportSummaryCaseFeature"; menuBuilder << "RicImportSummaryCasesFeature"; menuBuilder << "RicImportSummaryGroupFeature"; menuBuilder << "RicImportEnsembleFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryPlotFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicImportGridModelFromSummaryCaseFeature"; if ( !dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowSummaryCurveCalculatorFeature"; // menuBuilder << "RicNewSummaryPlotFeature"; } } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAddWellLogToPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteIntersectionsFeature"; menuBuilder.addSeparator(); menuBuilder << "RicAppendIntersectionFeature"; menuBuilder << "RicAppendIntersectionBoxFeature"; menuBuilder.addSeparator(); menuBuilder << "RicCopyIntersectionsToAllViewsInCaseFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteIntersectionsFeature"; menuBuilder.addSeparator(); menuBuilder << "RicAppendIntersectionFeature"; menuBuilder << "RicAppendIntersectionBoxFeature"; menuBuilder.addSeparator(); menuBuilder << "RicNewIntersectionViewFeature"; menuBuilder.addSeparator(); menuBuilder << "RicCopyIntersectionsToAllViewsInCaseFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteIntersectionsFeature"; menuBuilder.addSeparator(); menuBuilder << "RicAppendIntersectionFeature"; menuBuilder << "RicAppendIntersectionBoxFeature"; menuBuilder.addSeparator(); menuBuilder << "RicCopyIntersectionsToAllViewsInCaseFeature"; } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAppendSeparateIntersectionResultFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewWellLogCurveExtractionFeature"; menuBuilder << "RicNewWellLogRftCurveFeature"; menuBuilder << "RicNewSimWellIntersectionFeature"; menuBuilder.subMenuStart( "Well Plots", QIcon( ":/WellLogTrack16x16.png" ) ); menuBuilder << "RicNewRftPlotFeature"; menuBuilder << "RicNewPltPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicPlotProductionRateFeature"; menuBuilder << "RicShowWellAllocationPlotFeature"; menuBuilder << "RicShowCumulativePhasePlotFeature"; menuBuilder.subMenuEnd(); menuBuilder << "RicExportCompletionsForVisibleSimWellsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportCompletionsForVisibleSimWellsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicInsertColorLegendFeature"; menuBuilder << "RicImportColorCategoriesFeature"; // import of color legend from LYR file } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicInsertColorLegendFeature"; menuBuilder << "RicCopyStandardLegendFeature"; menuBuilder << "RicInsertColorLegendItemFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicInsertColorLegendItemFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportFormationNamesFeature"; menuBuilder << "RicReloadFormationNamesFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportFormationNamesFeature"; menuBuilder << "Separator"; menuBuilder << "RicReloadFormationNamesFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportFaultsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAddStoredWellAllocationPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAddStoredFlowCharacteristicsPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowFlowCharacteristicsPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowFlowCharacteristicsPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowGridStatisticsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewSimWellFractureFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewValveTemplateFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicDeleteValveTemplateFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportEnsembleFractureStatisticsFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportFaciesFeature"; menuBuilder << "RicImportElasticPropertiesFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewStimPlanModelTemplateFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteEllipseFractureFeature"; menuBuilder << "RicPasteStimPlanFractureFeature"; menuBuilder.addSeparator(); menuBuilder << "RicNewEllipseFractureTemplateFeature"; menuBuilder << "RicNewStimPlanFractureTemplateFeature"; menuBuilder << "Separator"; menuBuilder << "RicConvertAllFractureTemplatesToMetricFeature"; menuBuilder << "RicConvertAllFractureTemplatesToFieldFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteStimPlanFractureFeature"; menuBuilder << "RicPasteEllipseFractureFeature"; menuBuilder.addSeparator(); menuBuilder << "RicNewEllipseFractureTemplateFeature"; menuBuilder << "RicNewStimPlanFractureTemplateFeature"; menuBuilder << "Separator"; menuBuilder << "RicConvertFractureTemplateUnitFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteEllipseFractureFeature"; menuBuilder << "RicPasteStimPlanFractureFeature"; menuBuilder.addSeparator(); menuBuilder << "RicNewEllipseFractureTemplateFeature"; menuBuilder << "RicNewStimPlanFractureTemplateFeature"; menuBuilder << "Separator"; menuBuilder << "RicConvertFractureTemplateUnitFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewElasticPropertyScalingFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicImportSurfacesFeature"; menuBuilder << "RicNewGridSurfaceFeature"; menuBuilder.addSeparator(); menuBuilder << "RicNewSurfaceCollectionFeature"; } else if ( dynamic_cast( firstUiItem ) ) { if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportKLayerToPtlFeature"; } menuBuilder << "RicExportSurfaceToTsurfFeature"; menuBuilder << "Separator"; menuBuilder << "RicCopySurfaceFeature"; menuBuilder << "RicReloadSurfaceFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewPolygonFilterFeature"; menuBuilder << "RicNewUserDefinedFilterFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewCellRangeFilterFeature"; menuBuilder.subMenuStart( "Slice Filters" ); menuBuilder << "RicNewRangeFilterSliceIFeature"; menuBuilder << "RicNewRangeFilterSliceJFeature"; menuBuilder << "RicNewRangeFilterSliceKFeature"; menuBuilder.subMenuEnd(); } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateTextAnnotationFeature"; menuBuilder << "RicCreateReachCircleAnnotationFeature"; menuBuilder << "RicCreateUserDefinedPolylinesAnnotationFeature"; menuBuilder << "RicImportPolylinesAnnotationFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateTextAnnotationFeature"; } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicReloadPlotTemplatesFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicSnapshotViewToPdfFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewStreamlineFeature"; } if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "Separator"; menuBuilder << "RicLinkVisibleViewsFeature"; menuBuilder << "RicShowLinkOptionsFeature"; menuBuilder << "RicSetMasterViewFeature"; menuBuilder << "RicUnLinkViewFeature"; } } if ( firstUiItem ) { // Work in progress -- Start // All commands should be aware of selection of multiple objects // Based on the selection, the command feature can decide if the command // can be executed, communicated by isCommandEnabled(). When a command feature // is aware of multiple selected items, move the command to this list // without using dyncamic_cast. menuBuilder << "RicPasteTimeHistoryCurveFeature"; menuBuilder << "RicPasteAsciiDataCurveFeature"; menuBuilder << "RicPasteSummaryCaseFeature"; menuBuilder.addSeparator(); menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "RicLinkViewFeature"; menuBuilder << "RicShowPlotDataFeature"; menuBuilder << "RicShowTotalAllocationDataFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicNewSummaryPlotFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; menuBuilder.addSeparator(); menuBuilder << "RicConvertGroupToEnsembleFeature"; menuBuilder.addSeparator(); menuBuilder.addSeparator(); menuBuilder << "RicStackSelectedCurvesFeature"; menuBuilder << "RicUnstackSelectedCurvesFeature"; menuBuilder.addSeparator(); menuBuilder << "RicFlyToObjectFeature"; menuBuilder << "RicImportObservedDataFeature"; menuBuilder << "RicImportObservedFmuDataFeature"; menuBuilder << "RicReloadSummaryCaseFeature"; menuBuilder << "RicReplaceSummaryCaseFeature"; menuBuilder << "RicCreateSummaryCaseCollectionFeature"; menuBuilder << "Separator"; menuBuilder << "RicCutReferencesToClipboardFeature"; menuBuilder << "Separator"; if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreatePlotFromSelectionFeature"; menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature"; } menuBuilder << "Separator"; menuBuilder << "RicCloseSummaryCaseFeature"; menuBuilder << "RicCloseSummaryCaseInCollectionFeature"; menuBuilder << "RicDeleteSummaryCaseCollectionFeature"; menuBuilder << "RicCloseObservedDataFeature"; menuBuilder << "RicNewMultiPlotFeature"; // Work in progress -- End appendCreateCompletions( menuBuilder, menuBuilder.itemCount() > 0u ); bool addedExportWellPaths = appendExportWellPaths( menuBuilder, menuBuilder.itemCount() > 0u ) > 0; appendExportCompletions( menuBuilder, menuBuilder.itemCount() > 0u && !addedExportWellPaths ); if ( menuBuilder.itemCount() > 0u ) { menuBuilder.addSeparator(); } if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAddWellLogToPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { createExecuteScriptForCasesFeatureMenu( menuBuilder ); } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAddEclipseInputPropertyFeature"; menuBuilder << "RicReloadCaseFeature"; menuBuilder << "RicReplaceCaseFeature"; createExecuteScriptForCasesFeatureMenu( menuBuilder ); menuBuilder << "RicCloseSourSimDataFeature"; } else if ( dynamic_cast( firstUiItem ) ) { RimSummaryCrossPlot* summaryCrossPlot = dynamic_cast( firstUiItem ); if ( !summaryCrossPlot ) { menuBuilder << "RicAsciiExportSummaryPlotFeature"; } } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAsciiExportWellLogPlotFeature"; menuBuilder << "RicExportToLasFileFeature"; menuBuilder << "RicChangeDataSourceFeature"; } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportToLasFileFeature"; menuBuilder << "RicChangeDataSourceFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportToLasFileFeature"; } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicExportFaultsFeature"; #ifdef USE_ODB_API menuBuilder.subMenuStart( "Reactivation Assessment" ); menuBuilder << "RicRunBasicFaultReactAssessmentFeature"; menuBuilder << "RicRunAdvFaultReactAssessmentFeature"; menuBuilder.subMenuEnd(); } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder.subMenuStart( "Reactivation Assessment" ); menuBuilder << "RicRunBasicFaultReactAssessmentFeature"; menuBuilder << "RicRunAdvFaultReactAssessmentFeature"; menuBuilder.subMenuEnd(); #endif } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowContributingWellsFeature"; menuBuilder << "Separator"; menuBuilder << "RicEclipseWellShowLabelFeature"; menuBuilder << "RicEclipseWellShowHeadFeature"; menuBuilder << "RicEclipseWellShowPipeFeature"; menuBuilder << "RicEclipseWellShowSpheresFeature"; menuBuilder << "RicEclipseWellShowWellCellsFeature"; menuBuilder << "RicEclipseWellShowWellCellFenceFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewSimWellFractureFeature"; } menuBuilder.addSeparator(); menuBuilder << "RicCopyIntersectionsToAllViewsInCaseFeature"; } { bool toggleCommandCandidate = true; if ( firstUiItem ) { if ( dynamic_cast( firstUiItem ) ) { toggleCommandCandidate = false; } else if ( dynamic_cast( firstUiItem ) ) { toggleCommandCandidate = false; } else if ( dynamic_cast( firstUiItem ) ) { toggleCommandCandidate = false; } else if ( dynamic_cast( firstUiItem ) ) { toggleCommandCandidate = false; } else if ( dynamic_cast( firstUiItem ) ) { toggleCommandCandidate = false; } else if ( dynamic_cast( firstUiItem ) ) { toggleCommandCandidate = false; } } bool addSeparator = true; if ( toggleCommandCandidate && RicToggleItemsFeatureImpl::isToggleCommandsAvailable() ) { menuBuilder << "Separator"; menuBuilder << "RicToggleItemsOnFeature"; menuBuilder << "RicToggleItemsOffFeature"; menuBuilder << "RicToggleItemsFeature"; addSeparator = false; } if ( addSeparator ) { menuBuilder.addSeparator(); } if ( dynamic_cast( firstUiItem ) == nullptr ) { menuBuilder << "RicToggleItemsOnOthersOffFeature"; } if ( RicToggleItemsFeatureImpl::isToggleCommandsAvailable() ) { menuBuilder << "RicCollapseSiblingsFeature"; } menuBuilder << "RicMoveItemsToTopFeature"; menuBuilder << "RicSearchHelpFeature"; } if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteItemFeature" )->canFeatureBeExecuted() ) { menuBuilder << "Separator"; menuBuilder << "RicDeleteItemFeature"; } if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteSubItemsFeature" )->canFeatureBeExecuted() ) { menuBuilder << "Separator"; menuBuilder << "RicDeleteSubItemsFeature"; } // Special delete commands for specific features // Placed here to fit context menu location of general delete feature if ( caf::CmdFeatureManager::instance()->getCommandFeature( "Ric3dWellLogCurveDeleteFeature" )->canFeatureBeExecuted() ) { menuBuilder << "Separator"; menuBuilder << "Ric3dWellLogCurveDeleteFeature"; } if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicWellLogFileCloseFeature" )->canFeatureBeExecuted() ) { menuBuilder << "Separator"; menuBuilder << "RicWellLogFileCloseFeature"; } if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicCloseCaseFeature" )->canFeatureBeExecuted() ) { menuBuilder << "Separator"; menuBuilder << "RicCloseCaseFeature"; } return menuBuilder; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RimContextCommandBuilder::allWellPaths() { RimProject* proj = RimProject::current(); return proj->allWellPaths(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimContextCommandBuilder::createExecuteScriptForCasesFeatureMenu( caf::CmdFeatureMenuBuilder& menuBuilder ) { // Execute script on selection of cases RiuMainWindow* ruiMainWindow = RiuMainWindow::instance(); if ( ruiMainWindow ) { std::vector cases; ruiMainWindow->selectedCases( cases ); if ( cases.size() > 0 ) { menuBuilder.subMenuStart( "Execute script" ); RiaApplication* app = RiaApplication::instance(); RimProject* proj = app->project(); if ( proj && proj->scriptCollection() ) { RimScriptCollection* rootScriptCollection = proj->scriptCollection(); // Root script collection holds a list of subdirectories of user defined script folders for ( size_t i = 0; i < rootScriptCollection->subDirectories.size(); i++ ) { RimScriptCollection* subDir = rootScriptCollection->subDirectories[i]; if ( subDir ) { appendScriptItems( menuBuilder, subDir ); } } } menuBuilder.addSeparator(); menuBuilder.subMenuEnd(); } } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimContextCommandBuilder::appendScriptItems( caf::CmdFeatureMenuBuilder& menuBuilder, RimScriptCollection* scriptCollection ) { QDir dir( scriptCollection->directory ); menuBuilder.subMenuStart( dir.dirName() ); for ( size_t i = 0; i < scriptCollection->calcScripts.size(); i++ ) { RimCalcScript* calcScript = scriptCollection->calcScripts[i]; QFileInfo fi( calcScript->absoluteFileName() ); QString menuText = fi.baseName(); menuBuilder.addCmdFeatureWithUserData( "RicExecuteScriptForCasesFeature", menuText, QVariant( calcScript->absoluteFileName() ) ); } for ( size_t i = 0; i < scriptCollection->subDirectories.size(); i++ ) { RimScriptCollection* subDir = scriptCollection->subDirectories[i]; appendScriptItems( menuBuilder, subDir ); } menuBuilder.subMenuEnd(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RimContextCommandBuilder::appendImportMenu( caf::CmdFeatureMenuBuilder& menuBuilder, bool addSeparatorBeforeMenu ) { QStringList candidates; candidates << "RicWellPathsImportFileFeature"; candidates << "RicWellPathFormationsImportFileFeature"; candidates << "RicWellLogsImportFileFeature"; candidates << "RicReloadWellPathFormationNamesFeature"; return appendSubMenuWithCommands( menuBuilder, candidates, "Import", QIcon(), addSeparatorBeforeMenu ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RimContextCommandBuilder::appendCreateCompletions( caf::CmdFeatureMenuBuilder& menuBuilder, bool addSeparatorBeforeMenu ) { QStringList candidates; candidates << "RicNewPerforationIntervalFeature"; candidates << "RicEditPerforationCollectionFeature"; candidates << "RicNewValveFeature"; candidates << "RicNewFishbonesSubsFeature"; candidates << "RicNewWellPathFractureFeature"; candidates << "RicNewStimPlanModelFeature"; candidates << "Separator"; candidates << "RicCreateMultipleFracturesFeature"; candidates << "RicNewWellPathAttributeFeature"; candidates << "Separator"; candidates << "RicCreateTemporaryLgrFeature"; return appendSubMenuWithCommands( menuBuilder, candidates, "Create Completions", QIcon( ":/CompletionsSymbol16x16.png" ), addSeparatorBeforeMenu ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RimContextCommandBuilder::appendExportCompletions( caf::CmdFeatureMenuBuilder& menuBuilder, bool addSeparatorBeforeMenu ) { QStringList candidates; candidates << "RicExportCompletionsForVisibleWellPathsFeature"; candidates << "RicWellPathExportCompletionDataFeature"; candidates << "RicExportFishbonesLateralsFeature"; candidates << "RicExportCompletionsWellSegmentsFeature"; return appendSubMenuWithCommands( menuBuilder, candidates, "Export Completions", QIcon( ":/ExportCompletionsSymbol16x16.png" ), addSeparatorBeforeMenu ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RimContextCommandBuilder::appendExportWellPaths( caf::CmdFeatureMenuBuilder& menuBuilder, bool addSeparatorBeforeMenu ) { QStringList candidates; candidates << "RicExportSelectedWellPathsFeature"; candidates << "RicExportVisibleWellPathsFeature"; return appendSubMenuWithCommands( menuBuilder, candidates, "Export Well Paths", QIcon( ":/Save.svg" ), addSeparatorBeforeMenu ); } //------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RimContextCommandBuilder::appendSubMenuWithCommands( caf::CmdFeatureMenuBuilder& menuBuilder, const QStringList& commandCandidates, const QString& menuLabel, const QIcon& menuIcon /*= QIcon()*/, bool addSeparatorBeforeMenu /*=false*/ ) { int actualCommandsAdded = 0; QStringList validCommands; for ( QString candidate : commandCandidates ) { if ( candidate == "Separator" ) { validCommands << candidate; } else { if ( caf::CmdFeatureManager::instance()->getCommandFeature( candidate.toStdString() )->canFeatureBeExecuted() && !menuBuilder.isCmdFeatureAdded( candidate ) ) { validCommands << candidate; actualCommandsAdded++; } } } if ( actualCommandsAdded > 0 ) { if ( addSeparatorBeforeMenu ) { menuBuilder << "Separator"; } menuBuilder.subMenuStart( menuLabel, menuIcon ); for ( int i = 0; i < validCommands.size(); ++i ) { bool firstOrLast = i == 0 || i == validCommands.size() - 1; if ( !firstOrLast || validCommands[i] != "Separator" ) { menuBuilder << validCommands[i]; } } menuBuilder.subMenuEnd(); } return actualCommandsAdded; }