mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add StatisticsContourMap pdm object, and menu item.
This commit is contained in:
parent
c2ec023720
commit
c4dd4865f4
@ -97,6 +97,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewViewForGridEnsembleFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomVfpPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellTargetCandidatesGeneratorFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStatisticsContourMapFeature.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -198,6 +199,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewViewForGridEnsembleFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomVfpPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellTargetCandidatesGeneratorFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStatisticsContourMapFeature.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
|
@ -0,0 +1,86 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 "RicNewStatisticsContourMapFeature.h"
|
||||
|
||||
#include "RimEclipseCaseEnsemble.h"
|
||||
#include "RimStatisticsContourMap.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewStatisticsContourMapFeature, "RicNewStatisticsContourMapFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewStatisticsContourMapFeature::addStatisticsContourMap( RimEclipseCaseEnsemble* eclipseCaseEnsemble )
|
||||
{
|
||||
if ( !eclipseCaseEnsemble ) return;
|
||||
|
||||
std::vector<RimEclipseCase*> cases = eclipseCaseEnsemble->cases();
|
||||
if ( cases.empty() ) return;
|
||||
|
||||
RimStatisticsContourMap* statisticsContourMap = new RimStatisticsContourMap;
|
||||
statisticsContourMap->setEclipseCase( cases[0] );
|
||||
eclipseCaseEnsemble->addStatisticsContourMap( statisticsContourMap );
|
||||
eclipseCaseEnsemble->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewStatisticsContourMapFeature::isCommandEnabled() const
|
||||
{
|
||||
return selectedEclipseCaseEnsemble() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewStatisticsContourMapFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimEclipseCaseEnsemble* eclipseCaseEnsemble = selectedEclipseCaseEnsemble();
|
||||
addStatisticsContourMap( eclipseCaseEnsemble );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewStatisticsContourMapFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Statistics Contour Map" );
|
||||
actionToSetup->setIcon( QIcon( ":/3DView16x16.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCaseEnsemble* RicNewStatisticsContourMapFeature::selectedEclipseCaseEnsemble()
|
||||
{
|
||||
std::vector<RimEclipseCaseEnsemble*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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"
|
||||
|
||||
class RimEclipseCaseEnsemble;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewStatisticsContourMapFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void addStatisticsContourMap( RimEclipseCaseEnsemble* eclipseCaseEnsemble );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
static RimEclipseCaseEnsemble* selectedEclipseCaseEnsemble();
|
||||
};
|
@ -134,6 +134,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCameraPosition.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellTargetCandidatesGenerator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMap.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -268,6 +269,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCameraPosition.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellTargetCandidatesGenerator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMap.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseViewCollection.h"
|
||||
#include "RimStatisticsContourMap.h"
|
||||
#include "RimWellTargetCandidatesGenerator.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
@ -53,6 +54,8 @@ RimEclipseCaseEnsemble::RimEclipseCaseEnsemble()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellTargetGenerators, "WellTargetGenerators", "Well Target Candidates Generators" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_statisticsContourMaps, "StatisticsContourMaps", "Statistics Contour maps" );
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -173,6 +176,7 @@ void RimEclipseCaseEnsemble::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBu
|
||||
{
|
||||
menuBuilder << "RicNewViewForGridEnsembleFeature";
|
||||
menuBuilder << "RicNewWellTargetCandidatesGeneratorFeature";
|
||||
menuBuilder << "RicNewStatisticsContourMapFeature";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -190,3 +194,11 @@ void RimEclipseCaseEnsemble::addWellTargetsGenerator( RimWellTargetCandidatesGen
|
||||
{
|
||||
m_wellTargetGenerators.push_back( generator );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCaseEnsemble::addStatisticsContourMap( RimStatisticsContourMap* statisticsContourMap )
|
||||
{
|
||||
m_statisticsContourMaps.push_back( statisticsContourMap );
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimEclipseViewCollection;
|
||||
class RimWellTargetCandidatesGenerator;
|
||||
class RimStatisticsContourMap;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -57,6 +58,8 @@ public:
|
||||
|
||||
void addWellTargetsGenerator( RimWellTargetCandidatesGenerator* generator );
|
||||
|
||||
void addStatisticsContourMap( RimStatisticsContourMap* statisticsContourMap );
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
@ -67,5 +70,6 @@ private:
|
||||
caf::PdmChildField<RimCaseCollection*> m_caseCollection;
|
||||
caf::PdmChildField<RimEclipseViewCollection*> m_viewCollection;
|
||||
caf::PdmChildArrayField<RimWellTargetCandidatesGenerator*> m_wellTargetGenerators;
|
||||
caf::PdmChildArrayField<RimStatisticsContourMap*> m_statisticsContourMaps;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_selectedCase;
|
||||
};
|
||||
|
118
ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp
Normal file
118
ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 "RimStatisticsContourMap.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RimEclipseCaseEnsemble.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimStatisticsContourMap, "RimStatisticalContourMap" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStatisticsContourMap::RimStatisticsContourMap()
|
||||
{
|
||||
CAF_PDM_InitObject( "StatisticsContourMap", ":/Histogram16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "" );
|
||||
m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_resultDefinition = new RimEclipseResultDefinition;
|
||||
m_resultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result" );
|
||||
m_resultDefinition->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
m_resultDefinition->setResultVariable( "SOIL" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_computeStatisticsButton, "ComputeStatisticsButton", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorLabelLeft( &m_computeStatisticsButton );
|
||||
m_computeStatisticsButton = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsContourMap::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* resultDefinitionGroup = uiOrdering.addNewGroup( "Result Definition" );
|
||||
m_resultDefinition->uiOrdering( uiConfigName, *resultDefinitionGroup );
|
||||
|
||||
uiOrdering.add( &m_computeStatisticsButton );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsContourMap::setEclipseCase( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
m_resultDefinition->setEclipseCase( eclipseCase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsContourMap::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( &m_computeStatisticsButton == changedField )
|
||||
{
|
||||
computeStatistics();
|
||||
m_computeStatisticsButton = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsContourMap::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( &m_computeStatisticsButton == field )
|
||||
{
|
||||
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||
{
|
||||
attrib->m_buttonText = "Compute";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsContourMap::initAfterRead()
|
||||
{
|
||||
auto ensemble = firstAncestorOrThisOfType<RimEclipseCaseEnsemble>();
|
||||
if ( !ensemble ) return;
|
||||
|
||||
if ( ensemble->cases().empty() ) return;
|
||||
|
||||
RimEclipseCase* eclipseCase = ensemble->cases().front();
|
||||
setEclipseCase( eclipseCase );
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsContourMap::computeStatistics()
|
||||
{
|
||||
RiaLogging::info( "Computing statistics" );
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultDefinition;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimStatisticsContourMap : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimStatisticsContourMap();
|
||||
|
||||
void setEclipseCase( RimEclipseCase* eclipseCase );
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void computeStatistics();
|
||||
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_resultDefinition;
|
||||
caf::PdmField<bool> m_computeStatisticsButton;
|
||||
};
|
Loading…
Reference in New Issue
Block a user