mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add seismic 3d view (#10472)
* Show seismic, surfaces, annotations and wellpaths in new view not requiring a grid loaded first.
This commit is contained in:
@@ -7,6 +7,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicSection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicAlphaMapper.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSEGYConvertOptions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicView.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -18,6 +20,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSEGYConvertOptions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicDataInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicDifferenceData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSeismicView.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -59,7 +59,7 @@ RimSeismicData::RimSeismicData()
|
||||
, m_fileDataRange( 0, 0 )
|
||||
, m_activeDataRange( 0, 0 )
|
||||
{
|
||||
CAF_PDM_InitObject( "SeismicData", ":/Seismic16x16.png" );
|
||||
CAF_PDM_InitObject( "SeismicData", ":/SeismicData24x24.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_userDescription, "SeismicUserDecription", "Name" );
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimSeismicDataCollection, "SeismicDataCollection", "Seismic
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicDataCollection::RimSeismicDataCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Seismic", ":/Seismic16x16.png" );
|
||||
CAF_PDM_InitObject( "Data", ":/SeismicData24x24.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_seismicData, "SeismicData", "Seismic Data" );
|
||||
m_seismicData.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSeismicAlphaMapper.h"
|
||||
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimSeismicDataInterface, "SeismicDataInterface" ); // Abstract class.
|
||||
@@ -137,3 +139,53 @@ std::vector<double> RimSeismicDataInterface::alphaValues() const
|
||||
{
|
||||
return m_clippedAlphaValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSeismicDataInterface::inlineSpacing()
|
||||
{
|
||||
if ( !hasValidData() ) return 1.0;
|
||||
|
||||
cvf::Vec3d world1 = convertToWorldCoords( inlineMin(), xlineMin(), zMin() );
|
||||
cvf::Vec3d world2 = convertToWorldCoords( inlineMin() + 1, xlineMin(), zMin() );
|
||||
|
||||
return world1.pointDistance( world2 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicDataInterface::addSeismicOutline( RigPolyLinesData* pld )
|
||||
{
|
||||
if ( pld == nullptr ) return;
|
||||
|
||||
auto outline = worldOutline();
|
||||
if ( outline.size() == 8 )
|
||||
{
|
||||
// seismic bounding box could be all the way up to the sea surface,
|
||||
// make sure to skip bounding box check in drawing code
|
||||
pld->setSkipBoundingBoxCheck( true );
|
||||
|
||||
std::vector<cvf::Vec3d> box;
|
||||
|
||||
for ( auto i : { 4, 0, 1, 3, 2, 0 } )
|
||||
box.push_back( outline[i] );
|
||||
pld->addPolyLine( box );
|
||||
box.clear();
|
||||
|
||||
for ( auto i : { 1, 5, 4, 6, 7, 5 } )
|
||||
box.push_back( outline[i] );
|
||||
pld->addPolyLine( box );
|
||||
box.clear();
|
||||
|
||||
box.push_back( outline[2] );
|
||||
box.push_back( outline[6] );
|
||||
pld->addPolyLine( box );
|
||||
box.clear();
|
||||
|
||||
box.push_back( outline[3] );
|
||||
box.push_back( outline[7] );
|
||||
pld->addPolyLine( box );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
class RimSeismicAlphaMapper;
|
||||
class RimRegularLegendConfig;
|
||||
class RigPolyLinesData;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -56,6 +57,9 @@ public:
|
||||
virtual bool gridIsEqual( RimSeismicDataInterface* other );
|
||||
virtual RimRegularLegendConfig* legendConfig() const;
|
||||
virtual RimSeismicAlphaMapper* alphaValueMapper() const;
|
||||
virtual double inlineSpacing();
|
||||
|
||||
void addSeismicOutline( RigPolyLinesData* pld );
|
||||
|
||||
// interface to be implemented by subclasses
|
||||
public:
|
||||
|
||||
@@ -506,7 +506,7 @@ QList<caf::PdmOptionItemInfo> RimSeismicDifferenceData::calculateValueOptions( c
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( ( proj != nullptr ) && ( m_seismicData1() != nullptr ) )
|
||||
{
|
||||
const auto& coll = proj->activeOilField()->seismicCollection().p();
|
||||
const auto& coll = proj->activeOilField()->seismicDataCollection().p();
|
||||
|
||||
for ( auto seisData : coll->seismicData() )
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ CAF_PDM_SOURCE_INIT( RimSeismicSection, "SeismicSection" );
|
||||
RimSeismicSection::RimSeismicSection()
|
||||
: m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
{
|
||||
CAF_PDM_InitObject( "Seismic Section", ":/Seismic16x16.png" );
|
||||
CAF_PDM_InitObject( "Seismic Section", ":/SeismicSection16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_userDescription, "UserDescription", "Description" );
|
||||
|
||||
@@ -478,34 +478,7 @@ cvf::ref<RigPolyLinesData> RimSeismicSection::polyLinesData() const
|
||||
|
||||
if ( m_showSeismicOutline() && m_seismicData != nullptr )
|
||||
{
|
||||
auto outline = m_seismicData->worldOutline();
|
||||
if ( outline.size() == 8 )
|
||||
{
|
||||
// seismic bounding box could be all the way up to the sea surface,
|
||||
// make sure to skip bounding box check in drawing code
|
||||
pld->setSkipBoundingBoxCheck( true );
|
||||
|
||||
std::vector<cvf::Vec3d> box;
|
||||
|
||||
for ( auto i : { 4, 0, 1, 3, 2, 0 } )
|
||||
box.push_back( outline[i] );
|
||||
pld->addPolyLine( box );
|
||||
box.clear();
|
||||
|
||||
for ( auto i : { 1, 5, 4, 6, 7, 5 } )
|
||||
box.push_back( outline[i] );
|
||||
pld->addPolyLine( box );
|
||||
box.clear();
|
||||
|
||||
box.push_back( outline[2] );
|
||||
box.push_back( outline[6] );
|
||||
pld->addPolyLine( box );
|
||||
box.clear();
|
||||
|
||||
box.push_back( outline[3] );
|
||||
box.push_back( outline[7] );
|
||||
pld->addPolyLine( box );
|
||||
}
|
||||
m_seismicData->addSeismicOutline( pld.p() );
|
||||
}
|
||||
|
||||
pld->setLineAppearance( m_lineThickness, m_lineColor, false );
|
||||
@@ -752,6 +725,8 @@ void RimSeismicSection::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
}
|
||||
else if ( changedField == &m_showImage )
|
||||
{
|
||||
if ( m_seismicData == nullptr ) return;
|
||||
|
||||
QDialog w;
|
||||
QLabel l;
|
||||
QHBoxLayout layout;
|
||||
|
||||
@@ -72,7 +72,7 @@ RimSeismicSection* RimSeismicSectionCollection::addNewSection( RiaDefines::Seism
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj )
|
||||
{
|
||||
const auto& coll = proj->activeOilField()->seismicCollection().p();
|
||||
const auto& coll = proj->activeOilField()->seismicDataCollection().p();
|
||||
for ( auto* c : coll->seismicData() )
|
||||
{
|
||||
if ( c->boundingBox()->intersects( view->domainBoundingBox() ) )
|
||||
@@ -266,5 +266,5 @@ bool RimSeismicSectionCollection::shouldBeVisibleInTree() const
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj == nullptr ) return false;
|
||||
|
||||
return !proj->activeOilField()->seismicCollection()->isEmpty();
|
||||
return !proj->activeOilField()->seismicDataCollection()->isEmpty();
|
||||
}
|
||||
|
||||
580
ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp
Normal file
580
ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp
Normal file
@@ -0,0 +1,580 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSeismicView.h"
|
||||
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSeismicData.h"
|
||||
#include "RimSeismicSection.h"
|
||||
#include "RimSeismicSectionCollection.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
#include "RimSurfaceInViewCollection.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivPolylinePartMgr.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfScene.h"
|
||||
#include "cvfString.h"
|
||||
#include "cvfTransform.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSeismicView, "RimSeismicView", "SeismicView" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicView::RimSeismicView()
|
||||
{
|
||||
CAF_PDM_InitObject( "Seismic View", ":/SeismicView24x24.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_seismicData, "SeismicData", "Seismic Data" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceInViewCollection", "Surface Collection Field" );
|
||||
m_surfaceCollection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_seismicSectionCollection, "SeismicSectionCollection", "Seismic Collection Field" );
|
||||
m_seismicSectionCollection.uiCapability()->setUiTreeHidden( true );
|
||||
m_seismicSectionCollection = new RimSeismicSectionCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_annotationCollection, "AnnotationCollection", "Annotations" );
|
||||
m_annotationCollection.uiCapability()->setUiTreeHidden( true );
|
||||
m_annotationCollection = new RimAnnotationInViewCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_overlayInfoConfig, "OverlayInfoConfig", "Info Box" );
|
||||
m_overlayInfoConfig = new Rim3dOverlayInfoConfig();
|
||||
m_overlayInfoConfig->setReservoirView( this );
|
||||
m_overlayInfoConfig.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
m_scaleTransform = new cvf::Transform();
|
||||
|
||||
m_surfaceVizModel = new cvf::ModelBasicList;
|
||||
m_surfaceVizModel->setName( "SurfaceModel" );
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicView::~RimSeismicView()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::setSeismicData( RimSeismicData* data )
|
||||
{
|
||||
m_seismicData = data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicData* RimSeismicView::seismicData() const
|
||||
{
|
||||
return m_seismicData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::addSlice( RiaDefines::SeismicSectionType sectionType )
|
||||
{
|
||||
auto section = m_seismicSectionCollection->addNewSection( sectionType );
|
||||
section->setSeismicData( m_seismicData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurfaceInViewCollection* RimSeismicView::surfaceInViewCollection() const
|
||||
{
|
||||
return m_surfaceCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicSectionCollection* RimSeismicView::seismicSectionCollection() const
|
||||
{
|
||||
return m_seismicSectionCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RimSeismicView::ownerCase() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::View3dContent RimSeismicView::viewContent() const
|
||||
{
|
||||
return RiaDefines::View3dContent::SEISMIC;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSeismicView::isGridVisualizationMode() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSeismicView::isUsingFormationNames() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimLegendConfig*> RimSeismicView::legendConfigs() const
|
||||
{
|
||||
std::vector<RimLegendConfig*> legends;
|
||||
|
||||
if ( m_surfaceCollection )
|
||||
{
|
||||
for ( auto legendConfig : m_surfaceCollection->legendConfigs() )
|
||||
{
|
||||
legends.push_back( legendConfig );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto section : seismicSectionCollection()->seismicSections() )
|
||||
{
|
||||
legends.push_back( section->legendConfig() );
|
||||
}
|
||||
|
||||
legends.erase( std::remove( legends.begin(), legends.end(), nullptr ), legends.end() );
|
||||
|
||||
return legends;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::scheduleGeometryRegen( RivCellSetEnum geometryType )
|
||||
{
|
||||
// no need do do anything here
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimSeismicView::domainBoundingBox()
|
||||
{
|
||||
cvf::BoundingBox bb;
|
||||
|
||||
if ( m_seismicData )
|
||||
{
|
||||
bb.add( *m_seismicData->boundingBox() );
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_seismicData )
|
||||
{
|
||||
updateGridBoxData();
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
Rim3dView::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
auto genGrp = uiOrdering.addNewGroup( "General" );
|
||||
|
||||
genGrp->add( userDescriptionField() );
|
||||
genGrp->add( &m_seismicData );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
uiTreeOrdering.add( m_overlayInfoConfig() );
|
||||
uiTreeOrdering.add( seismicSectionCollection() );
|
||||
if ( surfaceInViewCollection() ) uiTreeOrdering.add( surfaceInViewCollection() );
|
||||
uiTreeOrdering.add( annotationCollection() );
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onCreateDisplayModel()
|
||||
{
|
||||
if ( nativeOrOverrideViewer() == nullptr ) return;
|
||||
|
||||
if ( !m_seismicData ) return;
|
||||
|
||||
// Remove all existing frames from the viewer.
|
||||
nativeOrOverrideViewer()->removeAllFrames( isUsingOverrideViewer() );
|
||||
|
||||
// Set the Main scene in the viewer.
|
||||
cvf::ref<cvf::Scene> mainScene = new cvf::Scene;
|
||||
|
||||
// Seismic sections
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> transform = displayCoordTransform();
|
||||
m_seismicVizModel->removeAllParts();
|
||||
|
||||
if ( m_polylinePartMgr.isNull() ) m_polylinePartMgr = new RivPolylinePartMgr( this, this, this );
|
||||
m_polylinePartMgr->appendDynamicGeometryPartsToModel( m_seismicVizModel.p(), transform.p(), domainBoundingBox() );
|
||||
|
||||
m_seismicSectionCollection->appendPartsToModel( this, m_seismicVizModel.p(), transform.p(), domainBoundingBox() );
|
||||
mainScene->addModel( m_seismicVizModel.p() );
|
||||
nativeOrOverrideViewer()->setMainScene( mainScene.p(), isUsingOverrideViewer() );
|
||||
|
||||
// Well path model
|
||||
|
||||
m_wellPathPipeVizModel->removeAllParts();
|
||||
addWellPathsToModel( m_wellPathPipeVizModel.p(), domainBoundingBox(), m_seismicData->inlineSpacing() );
|
||||
nativeOrOverrideViewer()->addStaticModelOnce( m_wellPathPipeVizModel.p(), isUsingOverrideViewer() );
|
||||
|
||||
// Surfaces
|
||||
|
||||
m_surfaceVizModel->removeAllParts();
|
||||
if ( m_surfaceCollection )
|
||||
{
|
||||
bool nativeOnly = true;
|
||||
m_surfaceCollection->appendPartsToModel( m_surfaceVizModel.p(), scaleTransform(), nativeOnly );
|
||||
nativeOrOverrideViewer()->addStaticModelOnce( m_surfaceVizModel.p(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
// Annotations
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> model = new cvf::ModelBasicList;
|
||||
model->setName( "Annotations" );
|
||||
addAnnotationsToModel( model.p() );
|
||||
mainScene->addModel( model.p() );
|
||||
|
||||
onUpdateLegends();
|
||||
if ( m_surfaceCollection )
|
||||
{
|
||||
m_surfaceCollection->applySingleColorEffect();
|
||||
}
|
||||
|
||||
if ( m_seismicData ) nativeOrOverrideViewer()->setPointOfInterest( m_seismicData->boundingBox()->center() );
|
||||
|
||||
m_overlayInfoConfig()->update3DInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onUpdateDisplayModelForCurrentTimeStep()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onClampCurrentTimestep()
|
||||
{
|
||||
m_currentTimeStep = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSeismicView::onTimeStepCountRequested()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSeismicView::isTimeStepDependentDataVisible() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::defineAxisLabels( cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel )
|
||||
{
|
||||
*xLabel = "E(x)";
|
||||
*yLabel = "N(y)";
|
||||
*zLabel = "Z";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onCreatePartCollectionFromSelection( cvf::Collection<cvf::Part>* parts )
|
||||
{
|
||||
// no action needed, might be needed if we want to hilite something later
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onUpdateStaticCellColors()
|
||||
{
|
||||
// no action needed
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onUpdateLegends()
|
||||
{
|
||||
if ( nativeOrOverrideViewer() )
|
||||
{
|
||||
if ( !isUsingOverrideViewer() )
|
||||
{
|
||||
nativeOrOverrideViewer()->removeAllColorLegends();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimLegendConfig*> legendConfs = this->legendConfigs();
|
||||
|
||||
for ( auto legendConf : legendConfs )
|
||||
{
|
||||
nativeOrOverrideViewer()->removeColorLegend( legendConf->titledOverlayFrame() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !nativeOrOverrideViewer() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_surfaceCollection && m_surfaceCollection->isChecked() )
|
||||
{
|
||||
m_surfaceCollection->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
if ( m_seismicSectionCollection->isChecked() )
|
||||
{
|
||||
m_seismicSectionCollection->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(), isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::onLoadDataAndUpdate()
|
||||
{
|
||||
updateSurfacesInViewTreeItems();
|
||||
syncronizeLocalAnnotationsFromGlobal();
|
||||
onUpdateScaleTransform();
|
||||
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( m_surfaceCollection ) m_surfaceCollection->loadData();
|
||||
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::selectOverlayInfoConfig()
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( m_overlayInfoConfig );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Transform* RimSeismicView::scaleTransform()
|
||||
{
|
||||
return m_scaleTransform.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSeismicView::createAutoName() const
|
||||
{
|
||||
if ( m_seismicData != nullptr )
|
||||
{
|
||||
return QString::fromStdString( m_seismicData->userDescription() );
|
||||
}
|
||||
|
||||
return "Seismic View";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::updateGridBoxData()
|
||||
{
|
||||
if ( viewer() )
|
||||
{
|
||||
viewer()->updateGridBoxData( m_scaleZ(), cvf::Vec3d::ZERO, backgroundColor(), domainBoundingBox(), fontSize() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::updateSurfacesInViewTreeItems()
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
RimSurfaceCollection* surfColl = proj->activeOilField()->surfaceCollection();
|
||||
|
||||
if ( surfColl && surfColl->containsSurface() )
|
||||
{
|
||||
if ( !m_surfaceCollection() )
|
||||
{
|
||||
m_surfaceCollection = new RimSurfaceInViewCollection();
|
||||
}
|
||||
|
||||
m_surfaceCollection->setSurfaceCollection( surfColl );
|
||||
m_surfaceCollection->updateFromSurfaceCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_surfaceCollection;
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigPolyLinesData> RimSeismicView::polyLinesData() const
|
||||
{
|
||||
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||
|
||||
if ( m_seismicData != nullptr )
|
||||
{
|
||||
m_seismicData->addSeismicOutline( pld.p() );
|
||||
pld->setLineAppearance( 1, { 255, 255, 255 }, false );
|
||||
pld->setZPlaneLock( false, 0.0 );
|
||||
pld->setVisibility( true, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
pld->setVisibility( false, false );
|
||||
}
|
||||
|
||||
return pld;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::setDefaultView()
|
||||
{
|
||||
if ( viewer() )
|
||||
{
|
||||
viewer()->setDefaultView( cvf::Vec3d::Y_AXIS, cvf::Vec3d::Z_AXIS );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimSeismicView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_seismicData )
|
||||
{
|
||||
RimTools::seismicDataOptionItems( &options, domainBoundingBox() );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSeismicView::characteristicCellSize() const
|
||||
{
|
||||
if ( m_seismicData != nullptr )
|
||||
{
|
||||
return m_seismicData->inlineSpacing();
|
||||
}
|
||||
|
||||
return Rim3dView::characteristicCellSize();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigHistogramData RimSeismicView::histogramData()
|
||||
{
|
||||
RigHistogramData histData;
|
||||
|
||||
if ( m_seismicData )
|
||||
{
|
||||
auto xvals = m_seismicData->histogramXvalues();
|
||||
auto yvals = m_seismicData->histogramYvalues();
|
||||
|
||||
histData.min = xvals.front();
|
||||
histData.max = xvals.back();
|
||||
histData.mean = 0.0;
|
||||
histData.sum = 0.0;
|
||||
|
||||
histData.histogram.resize( yvals.size() );
|
||||
|
||||
int i = 0;
|
||||
for ( auto val : yvals )
|
||||
{
|
||||
histData.histogram[i++] = (size_t)val;
|
||||
}
|
||||
}
|
||||
return histData;
|
||||
}
|
||||
107
ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.h
Normal file
107
ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RiaSeismicDefines.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimPolylinesDataInterface.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimCase;
|
||||
class RimSeismicData;
|
||||
class RimSurfaceInViewCollection;
|
||||
class RimSeismicSectionCollection;
|
||||
class Rim3dOverlayInfoConfig;
|
||||
class RivPolylinePartMgr;
|
||||
class RigHistogramData;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
class RimSeismicView : public Rim3dView, public RimPolylinesDataInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSeismicView();
|
||||
~RimSeismicView() override;
|
||||
|
||||
void setSeismicData( RimSeismicData* data );
|
||||
RimSeismicData* seismicData() const;
|
||||
|
||||
void addSlice( RiaDefines::SeismicSectionType sectionType );
|
||||
|
||||
RimSurfaceInViewCollection* surfaceInViewCollection() const;
|
||||
RimSeismicSectionCollection* seismicSectionCollection() const;
|
||||
|
||||
RimCase* ownerCase() const override;
|
||||
RiaDefines::View3dContent viewContent() const override;
|
||||
bool isGridVisualizationMode() const override;
|
||||
bool isUsingFormationNames() const override;
|
||||
std::vector<RimLegendConfig*> legendConfigs() const override;
|
||||
void scheduleGeometryRegen( RivCellSetEnum geometryType ) override;
|
||||
|
||||
cvf::BoundingBox domainBoundingBox() override;
|
||||
void updateGridBoxData() override;
|
||||
double characteristicCellSize() const override;
|
||||
RigHistogramData histogramData();
|
||||
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void onCreateDisplayModel() override;
|
||||
void onUpdateDisplayModelForCurrentTimeStep() override;
|
||||
void onClampCurrentTimestep() override;
|
||||
size_t onTimeStepCountRequested() override;
|
||||
bool isTimeStepDependentDataVisible() const override;
|
||||
void defineAxisLabels( cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel ) override;
|
||||
void onCreatePartCollectionFromSelection( cvf::Collection<cvf::Part>* parts ) override;
|
||||
void onUpdateStaticCellColors() override;
|
||||
void onUpdateLegends() override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
void selectOverlayInfoConfig() override;
|
||||
|
||||
cvf::Transform* scaleTransform() override;
|
||||
|
||||
QString createAutoName() const override;
|
||||
|
||||
void setDefaultView() override;
|
||||
|
||||
void updateSurfacesInViewTreeItems() override;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimSurfaceInViewCollection*> m_surfaceCollection;
|
||||
caf::PdmChildField<RimSeismicSectionCollection*> m_seismicSectionCollection;
|
||||
|
||||
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
|
||||
|
||||
caf::PdmPtrField<RimSeismicData*> m_seismicData;
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> m_surfaceVizModel;
|
||||
cvf::ref<RivPolylinePartMgr> m_polylinePartMgr;
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSeismicViewCollection.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSeismicView.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSeismicViewCollection, "SeismicViewCollection", "SeismicViewCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicViewCollection::RimSeismicViewCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Views", ":/SeismicViews24x24.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_views, "Views", "Seismic Views" );
|
||||
m_views.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
setDeletable( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicViewCollection::~RimSeismicViewCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSeismicView*> RimSeismicViewCollection::views() const
|
||||
{
|
||||
return m_views.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSeismicViewCollection::isEmpty()
|
||||
{
|
||||
return !m_views.hasChildren();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicView* RimSeismicViewCollection::addView( RimSeismicData* data, RiaDefines::SeismicSectionType defaultSection )
|
||||
{
|
||||
RimSeismicView* view = new RimSeismicView();
|
||||
|
||||
view->setSeismicData( data );
|
||||
view->loadDataAndUpdate();
|
||||
|
||||
view->addSlice( defaultSection );
|
||||
|
||||
m_views.push_back( view );
|
||||
|
||||
return view;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RiaSeismicDefines.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimSeismicView;
|
||||
class RimSeismicData;
|
||||
|
||||
class RimSeismicViewCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSeismicViewCollection();
|
||||
~RimSeismicViewCollection() override;
|
||||
|
||||
bool isEmpty();
|
||||
|
||||
RimSeismicView* addView( RimSeismicData* data, RiaDefines::SeismicSectionType defaultSection );
|
||||
|
||||
std::vector<RimSeismicView*> views() const;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimSeismicView*> m_views;
|
||||
};
|
||||
Reference in New Issue
Block a user