mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
- Added RimGeneric3dView, a 3D view that is not tied to any grid case, useful for wells, surfaces and other data not requiring a reservoir grid. The view supports a custom name. - Introduced RimGenericViewCollection, a new top-level collection that holds both Eclipse views and RimGeneric3dView instances. It overrides defineUiTreeOrdering() to display both types as a single flat list under the top-level 'Views' node. - RimOilField now exposes a single genericViewCollection instead of a plain eclipseViewCollection field. - RimEclipseViewCollection is unchanged and continues to be used for per-case and ensemble view collections. - Updated RimEclipseCase::globalViewCollection() and related helpers to use RimGenericViewCollection, and added matching overloads in RicNewViewFeature for creating eclipse views from the merged collection. - Added RicNewGenericDataViewFeature to create a new generic data view from the context menu.
129 lines
4.6 KiB
C++
129 lines
4.6 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2023 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 "RicNewSeismicViewFeature.h"
|
|
|
|
#include "RiaApplication.h"
|
|
#include "RiaSeismicDefines.h"
|
|
|
|
#include "RimGeneric3dView.h"
|
|
#include "RimOilField.h"
|
|
#include "RimProject.h"
|
|
#include "RimSeismicData.h"
|
|
#include "RimSeismicDataCollection.h"
|
|
#include "RimSeismicSection.h"
|
|
#include "RimSeismicSectionCollection.h"
|
|
#include "RimSeismicView.h"
|
|
#include "RimSeismicViewCollection.h"
|
|
|
|
#include "Riu3DMainWindowTools.h"
|
|
|
|
#include "cafPdmUiPropertyViewDialog.h"
|
|
#include "cafSelectionManagerTools.h"
|
|
#include "cafUtils.h"
|
|
|
|
#include <QAction>
|
|
#include <QMessageBox>
|
|
|
|
CAF_CMD_SOURCE_INIT( RicNewSeismicViewFeature, "RicNewSeismicViewFeature" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RicNewSeismicViewFeature::isCommandEnabled() const
|
|
{
|
|
auto proj = RimProject::current();
|
|
auto& seisColl = proj->activeOilField()->seismicDataCollection();
|
|
return ( seisColl && !seisColl->isEmpty() );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
|
{
|
|
createSeismicView( caf::SelectionManager::instance()->selectedItemOfType<RimSeismicData>() );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicNewSeismicViewFeature::setupActionLook( QAction* actionToSetup )
|
|
{
|
|
actionToSetup->setIcon( QIcon( ":/SeismicView16x16.png" ) );
|
|
actionToSetup->setText( "New Seismic View" );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimSeismicView* RicNewSeismicViewFeature::createInitialViewIfNeeded( RimSeismicDataInterface* seisData )
|
|
{
|
|
auto proj = RimProject::current();
|
|
|
|
// Only auto-create when the project has no 3D view at all, but ignore any auto-created data view -
|
|
// that view has no seismic content, and importing seismic should still get its own view.
|
|
for ( auto view : proj->allViews() )
|
|
{
|
|
if ( !dynamic_cast<RimGeneric3dView*>( view ) ) return nullptr;
|
|
}
|
|
|
|
return createSeismicView( seisData );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimSeismicView* RicNewSeismicViewFeature::createSeismicView( RimSeismicDataInterface* seisData )
|
|
{
|
|
auto proj = RimProject::current();
|
|
auto& seisViewColl = proj->activeOilField()->seismicViewCollection();
|
|
auto& seisDataColl = proj->activeOilField()->seismicDataCollection();
|
|
if ( !seisViewColl || !seisDataColl ) return nullptr;
|
|
|
|
if ( ( seisData == nullptr ) && !seisDataColl->isEmpty() )
|
|
{
|
|
seisData = seisDataColl->seismicData()[0];
|
|
}
|
|
|
|
if ( seisData )
|
|
{
|
|
auto view = seisViewColl->addView( seisData, RiaDefines::SeismicSectionType::SS_INLINE );
|
|
|
|
if ( view )
|
|
{
|
|
seisViewColl->updateAllRequiredEditors();
|
|
view->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
if ( view->seismicSectionCollection()->size() > 0 )
|
|
{
|
|
auto section = view->seismicSectionCollection()->seismicSections()[0];
|
|
Riu3DMainWindowTools::selectAsCurrentItem( section );
|
|
}
|
|
else
|
|
{
|
|
Riu3DMainWindowTools::selectAsCurrentItem( view );
|
|
}
|
|
}
|
|
|
|
return view;
|
|
}
|
|
|
|
return nullptr;
|
|
}
|