mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#14797 Add command to compute contour map peaks
Available from the contour map context menu for Eclipse, GeoMech and ensemble statistics contour maps.
This commit is contained in:
1 parent
503ea3eb74
commit
c6664a3361
4 files changed
+111
No files matched your search
@@ -99,6 +99,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateContourMapPolygonFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateContourMapPolygonAdvancedFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateContourMapPolygonTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicComputeContourMapPeaksFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPolygonFromImageDialog.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateSummaryEnsembleFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportGridAndSummaryEnsembleDialog.cpp
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- Equinor 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 "RicComputeContourMapPeaksFeature.h"
|
||||
|
||||
#include "RicExportContourMapToTextFeature.h"
|
||||
|
||||
#include "ContourMap/RimContourMapPeaksCollection.h"
|
||||
#include "ContourMap/RimContourMapProjection.h"
|
||||
#include "ContourMap/RimEclipseContourMapView.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicComputeContourMapPeaksFeature, "RicComputeContourMapPeaksFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Enabled for all contour map view types (Eclipse, GeoMech and ensemble statistics).
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicComputeContourMapPeaksFeature::isCommandEnabled() const
|
||||
{
|
||||
auto [existingEclipseContourMap, existingGeoMechContourMap] = RicExportContourMapToTextFeature::findContourMapView();
|
||||
|
||||
return existingEclipseContourMap || existingGeoMechContourMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Computes peaks using the peaks collection's current (default, unless previously edited) peakCount and
|
||||
/// minDistance field values. Use the "Contour Map Peaks" object's own property panel to customize and
|
||||
/// recompute.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicComputeContourMapPeaksFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto [existingEclipseContourMap, existingGeoMechContourMap] = RicExportContourMapToTextFeature::findContourMapView();
|
||||
|
||||
RimContourMapProjection* contourMapProjection = nullptr;
|
||||
if ( existingEclipseContourMap ) contourMapProjection = existingEclipseContourMap->contourMapProjection();
|
||||
if ( existingGeoMechContourMap ) contourMapProjection = existingGeoMechContourMap->contourMapProjection();
|
||||
if ( !contourMapProjection ) return;
|
||||
|
||||
auto* peaksCollection = contourMapProjection->peaksCollection();
|
||||
if ( !peaksCollection ) return;
|
||||
|
||||
peaksCollection->computePeaks();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicComputeContourMapPeaksFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/WellTargetPoint16x16.png" ) );
|
||||
actionToSetup->setText( "Compute Contour Map Peaks" );
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- Equinor 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"
|
||||
|
||||
//==================================================================================================
|
||||
/// Compute the N most significant peaks (local maxima) in the current contour map, and create a marker
|
||||
/// (single-point polygon) for each in the project tree.
|
||||
///
|
||||
/// Available for Eclipse and GeoMech contour maps, including ensemble statistics contour maps
|
||||
/// (RimStatisticsContourMapView derives from RimEclipseContourMapView).
|
||||
//==================================================================================================
|
||||
class RicComputeContourMapPeaksFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -661,6 +661,9 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
||||
menuBuilder << "RicCreateContourMapPolygonAdvancedFeature";
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicExportContourMapToTextFeature";
|
||||
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicComputeContourMapPeaksFeature";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user