-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Statistics Contour Map for eclipse grid ensembles.
- Loading branch information
Showing
25 changed files
with
1,232 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
ApplicationLibCode/Commands/RicNewStatisticsContourMapViewFeature.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// 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 "RicNewStatisticsContourMapViewFeature.h" | ||
|
||
#include "RimCellFilterCollection.h" | ||
#include "RimEclipseCase.h" | ||
#include "RimEclipseContourMapViewCollection.h" | ||
#include "RimFaultInViewCollection.h" | ||
#include "RimOilField.h" | ||
#include "RimProject.h" | ||
#include "RimSimWellInViewCollection.h" | ||
#include "RimStatisticsContourMap.h" | ||
#include "RimStatisticsContourMapView.h" | ||
#include "RimSurfaceInViewCollection.h" | ||
|
||
#include "Riu3DMainWindowTools.h" | ||
#include "RiuGuiTheme.h" | ||
|
||
#include "RiaColorTools.h" | ||
|
||
#include "cafPdmDocument.h" | ||
#include "cafSelectionManager.h" | ||
|
||
#include <QAction> | ||
|
||
CAF_CMD_SOURCE_INIT( RicNewStatisticsContourMapViewFeature, "RicNewStatisticsContourMapViewFeature" ); | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
bool RicNewStatisticsContourMapViewFeature::isCommandEnabled() const | ||
{ | ||
auto contourMap = caf::SelectionManager::instance()->selectedItemOfType<RimStatisticsContourMap>(); | ||
return contourMap != nullptr; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RicNewStatisticsContourMapViewFeature::onActionTriggered( bool isChecked ) | ||
{ | ||
auto contourMap = caf::SelectionManager::instance()->selectedItemOfType<RimStatisticsContourMap>(); | ||
if ( !contourMap ) return; | ||
|
||
RimEclipseCase* eclipseCase = contourMap->eclipseCase(); | ||
if ( !eclipseCase ) return; | ||
|
||
if ( auto eclipseContourMap = createStatisticsContourMapView( contourMap, eclipseCase ) ) | ||
{ | ||
// Must be run before buildViewItems, as wells are created in this function | ||
eclipseContourMap->loadDataAndUpdate(); | ||
|
||
// make sure no surfaces are shown in the view when the contourmap is generated | ||
if ( eclipseContourMap->surfaceInViewCollection() ) eclipseContourMap->surfaceInViewCollection()->setCheckState( Qt::Unchecked ); | ||
|
||
if ( eclipseCase ) | ||
{ | ||
eclipseCase->updateConnectedEditors(); | ||
eclipseContourMap->cellFilterCollection()->setCase( eclipseCase ); | ||
} | ||
caf::SelectionManager::instance()->setSelectedItem( eclipseContourMap ); | ||
|
||
eclipseContourMap->createDisplayModelAndRedraw(); | ||
eclipseContourMap->zoomAll(); | ||
|
||
RimProject* project = RimProject::current(); | ||
|
||
RimOilField* oilField = project->activeOilField(); | ||
|
||
oilField->eclipseContourMapCollection()->updateConnectedEditors(); | ||
|
||
Riu3DMainWindowTools::setExpanded( eclipseContourMap ); | ||
Riu3DMainWindowTools::selectAsCurrentItem( eclipseContourMap ); | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RicNewStatisticsContourMapViewFeature::setupActionLook( QAction* actionToSetup ) | ||
{ | ||
actionToSetup->setText( "Create View" ); | ||
actionToSetup->setIcon( QIcon( ":/2DMap16x16.png" ) ); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RimStatisticsContourMapView* RicNewStatisticsContourMapViewFeature::createStatisticsContourMapView( RimStatisticsContourMap* statisticsContourMap, | ||
RimEclipseCase* eclipseCase ) | ||
{ | ||
RimStatisticsContourMapView* contourMap = new RimStatisticsContourMapView; | ||
contourMap->setStatisticsContourMap( statisticsContourMap ); | ||
contourMap->setEclipseCase( eclipseCase ); | ||
|
||
caf::PdmDocument::updateUiIconStateRecursively( contourMap ); | ||
|
||
size_t i = eclipseCase->contourMapCollection()->views().size(); | ||
contourMap->setName( QString( "Contour Map %1" ).arg( i + 1 ) ); | ||
|
||
contourMap->faultCollection()->setActive( false ); | ||
contourMap->wellCollection()->isActive = false; | ||
|
||
eclipseCase->contourMapCollection()->addView( contourMap ); | ||
|
||
auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" ); | ||
contourMap->setBackgroundColor( RiaColorTools::fromQColorTo3f( col ) ); // Ignore original view background | ||
|
||
contourMap->initAfterReadRecursively(); | ||
|
||
return contourMap; | ||
} |
41 changes: 41 additions & 0 deletions
41
ApplicationLibCode/Commands/RicNewStatisticsContourMapViewFeature.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 RimEclipseCase; | ||
class RimStatisticsContourMapView; | ||
class RimStatisticsContourMap; | ||
|
||
//================================================================================================== | ||
/// | ||
//================================================================================================== | ||
class RicNewStatisticsContourMapViewFeature : public caf::CmdFeature | ||
{ | ||
CAF_CMD_HEADER_INIT; | ||
|
||
protected: | ||
bool isCommandEnabled() const override; | ||
void onActionTriggered( bool isChecked ) override; | ||
void setupActionLook( QAction* actionToSetup ) override; | ||
|
||
static RimStatisticsContourMapView* createStatisticsContourMapView( RimStatisticsContourMap* statisticsContourMap, | ||
RimEclipseCase* eclipseCase ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.