diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 9739779c49..32ff262ffc 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -275,7 +275,12 @@ open-text-editor.svg Seismic16x16.png SeismicDelta16x16.png - Fullscreen.png + SeismicView16x16.png + SeismicView24x24.png + SeismicViews24x24.png + SeismicData24x24.png + SeismicSection16x16.png + Fullscreen.png plot-template-standard.svg plot-template-ensemble.svg decline-curve.svg diff --git a/ApplicationExeCode/Resources/SeismicData24x24.png b/ApplicationExeCode/Resources/SeismicData24x24.png new file mode 100644 index 0000000000..e0f092ec8e Binary files /dev/null and b/ApplicationExeCode/Resources/SeismicData24x24.png differ diff --git a/ApplicationExeCode/Resources/SeismicSection16x16.png b/ApplicationExeCode/Resources/SeismicSection16x16.png new file mode 100644 index 0000000000..de4b71bc03 Binary files /dev/null and b/ApplicationExeCode/Resources/SeismicSection16x16.png differ diff --git a/ApplicationExeCode/Resources/SeismicView16x16.png b/ApplicationExeCode/Resources/SeismicView16x16.png new file mode 100644 index 0000000000..9b0230f94b Binary files /dev/null and b/ApplicationExeCode/Resources/SeismicView16x16.png differ diff --git a/ApplicationExeCode/Resources/SeismicView24x24.png b/ApplicationExeCode/Resources/SeismicView24x24.png new file mode 100644 index 0000000000..8bc614f014 Binary files /dev/null and b/ApplicationExeCode/Resources/SeismicView24x24.png differ diff --git a/ApplicationExeCode/Resources/SeismicViews24x24.png b/ApplicationExeCode/Resources/SeismicViews24x24.png new file mode 100644 index 0000000000..d6481195b6 Binary files /dev/null and b/ApplicationExeCode/Resources/SeismicViews24x24.png differ diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index ae815a1b33..32cce6a2b5 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -68,6 +68,8 @@ #include "RimPlotWindow.h" #include "RimProject.h" #include "RimScriptCollection.h" +#include "RimSeismicView.h" +#include "RimSeismicViewCollection.h" #include "RimSimWellInViewCollection.h" #include "RimStimPlanColors.h" #include "RimStimPlanModel.h" @@ -669,6 +671,14 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct cas->intersectionViewCollection()->syncFromExistingIntersections( false ); } + for ( RimOilField* oilField : m_project->oilFields ) + { + for ( auto seisView : oilField->seismicViewCollection()->views() ) + { + seisView->loadDataAndUpdate(); + } + } + // Init summary case groups for ( RimOilField* oilField : m_project->oilFields ) { diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index ed58fae8c4..097196c77f 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -230,7 +230,8 @@ enum class View3dContent GEOMECH_DATA = 0b00000010, FLAT_INTERSECTION = 0b00000100, CONTOUR = 0b00001000, - ALL = 0b00001111 + SEISMIC = 0b00010000, + ALL = 0b00011111 }; }; // namespace RiaDefines diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicTextAnnotation3dEditor.cpp b/ApplicationLibCode/Commands/AnnotationCommands/RicTextAnnotation3dEditor.cpp index cf23e0f5f1..6b4c40cbd6 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicTextAnnotation3dEditor.cpp +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicTextAnnotation3dEditor.cpp @@ -102,7 +102,7 @@ void RicTextAnnotation3dEditor::configureAndUpdateUi( const QString& uiConfigNam } cvf::ref dispXf = view->displayCoordTransform(); - double handleSize = 0.7 * view->ownerCase()->characteristicCellSize(); + double handleSize = 0.7 * view->characteristicCellSize(); cvf::Vec3d labelPos( textAnnot->m_labelPointXyd() ); labelPos.z() *= -1.0; diff --git a/ApplicationLibCode/Commands/SeismicCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SeismicCommands/CMakeLists_files.cmake index e49753d665..7ded139c80 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SeismicCommands/CMakeLists_files.cmake @@ -8,6 +8,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewWellpathSeismicSectionFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSeismicSectionFromIntersectionFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSeismicDifferenceFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewSeismicViewFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -20,6 +21,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewWellpathSeismicSectionFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSeismicSectionFromIntersectionFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSeismicDifferenceFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewSeismicViewFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp index 1757444031..a939a4273d 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp @@ -63,7 +63,7 @@ void RicImportSeismicFeature::onActionTriggered( bool isChecked ) app->setLastUsedDialogDirectory( "SEISMIC_GRID", QFileInfo( fileName ).absolutePath() ); auto proj = RimProject::current(); - auto& seisColl = proj->activeOilField()->seismicCollection(); + auto& seisColl = proj->activeOilField()->seismicDataCollection(); if ( !seisColl ) return; diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewInlineSeismicSectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewInlineSeismicSectionFeature.cpp index 49b772cdf2..748a74a9e8 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewInlineSeismicSectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewInlineSeismicSectionFeature.cpp @@ -37,6 +37,6 @@ void RicNewInlineSeismicSectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicNewInlineSeismicSectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/SeismicSection16x16.png" ) ); actionToSetup->setText( "New Inline Section" ); } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewPolylineSeismicSectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewPolylineSeismicSectionFeature.cpp index 81f296db45..a86c60d819 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewPolylineSeismicSectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewPolylineSeismicSectionFeature.cpp @@ -37,6 +37,6 @@ void RicNewPolylineSeismicSectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicNewPolylineSeismicSectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/SeismicSection16x16.png" ) ); actionToSetup->setText( "New Polyline Section" ); } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicDifferenceFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicDifferenceFeature.cpp index 5d94ddd4bb..9e0b15332b 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicDifferenceFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicDifferenceFeature.cpp @@ -51,7 +51,7 @@ bool RicNewSeismicDifferenceFeature::isCommandEnabled() const void RicNewSeismicDifferenceFeature::onActionTriggered( bool isChecked ) { auto proj = RimProject::current(); - auto& seisColl = proj->activeOilField()->seismicCollection(); + auto& seisColl = proj->activeOilField()->seismicDataCollection(); if ( !seisColl ) return; auto seismicInput = selectedSeismic(); diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp new file mode 100644 index 0000000000..0994ffef6b --- /dev/null +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewSeismicViewFeature.h" + +#include "RiaApplication.h" +#include "RiaSeismicDefines.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 +#include + +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 ) +{ + auto proj = RimProject::current(); + auto& seisViewColl = proj->activeOilField()->seismicViewCollection(); + auto& seisDataColl = proj->activeOilField()->seismicDataCollection(); + if ( !seisViewColl || !seisDataColl ) return; + + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + + RimSeismicData* selectedData = nullptr; + + if ( uiItems.size() > 0 ) + { + selectedData = dynamic_cast( uiItems[0] ); + } + + if ( ( selectedData == nullptr ) && !seisDataColl->isEmpty() ) + { + selectedData = seisDataColl->seismicData()[0]; + } + + if ( selectedData ) + { + auto view = seisViewColl->addView( selectedData, 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 ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSeismicViewFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setIcon( QIcon( ":/SeismicView16x16.png" ) ); + actionToSetup->setText( "New Seismic View" ); +} diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.h b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.h new file mode 100644 index 0000000000..25623aad75 --- /dev/null +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicNewSeismicViewFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() const override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewWellpathSeismicSectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewWellpathSeismicSectionFeature.cpp index 256e4936e8..56c26489b9 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewWellpathSeismicSectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewWellpathSeismicSectionFeature.cpp @@ -37,6 +37,6 @@ void RicNewWellpathSeismicSectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicNewWellpathSeismicSectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/SeismicSection16x16.png" ) ); actionToSetup->setText( "New Well Path Section" ); } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewXlineSeismicSectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewXlineSeismicSectionFeature.cpp index 860c86a097..f8e9780dff 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewXlineSeismicSectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewXlineSeismicSectionFeature.cpp @@ -37,6 +37,6 @@ void RicNewXlineSeismicSectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicNewXlineSeismicSectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/SeismicSection16x16.png" ) ); actionToSetup->setText( "New Xline Section" ); } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewZSliceSeismicSectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewZSliceSeismicSectionFeature.cpp index 11b40b9c56..46b43f053c 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewZSliceSeismicSectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewZSliceSeismicSectionFeature.cpp @@ -37,6 +37,6 @@ void RicNewZSliceSeismicSectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicNewZSliceSeismicSectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/SeismicSection16x16.png" ) ); actionToSetup->setText( "New Depth Slice" ); } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp index 951c15c64d..b6d73a85bc 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp @@ -113,7 +113,7 @@ void RicSeismicSectionFromIntersectionFeature::onActionTriggered( bool isChecked //-------------------------------------------------------------------------------------------------- void RicSeismicSectionFromIntersectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/SeismicSection16x16.png" ) ); actionToSetup->setText( "Create as Seismic Section" ); } diff --git a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolylineTarget3dEditor.cpp b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolylineTarget3dEditor.cpp index 5600965327..4c1860e278 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolylineTarget3dEditor.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolylineTarget3dEditor.cpp @@ -98,7 +98,7 @@ void RicPolylineTarget3dEditor::configureAndUpdateUi( const QString& uiConfigNam } cvf::ref dispXf = view->displayCoordTransform(); - double handleSize = 0.7 * view->ownerCase()->characteristicCellSize(); + double handleSize = 0.7 * view->characteristicCellSize(); m_manipulator->setOrigin( dispXf->transformToDisplayCoord( target->targetPointXYZ() ) ); // m_manipulator->setTangent(target->tangent()); diff --git a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp index d91504ad6a..05c878c35a 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp @@ -111,7 +111,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName ) } cvf::ref dispXf = view->displayCoordTransform(); - double handleSize = view->ownerCase()->characteristicCellSize() * geomDef->wellTargetScalingFactor(); + double handleSize = view->characteristicCellSize() * geomDef->wellTargetScalingFactor(); m_manipulator->setOrigin( dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->anchorPointXyz() ) ); m_manipulator->setTangent( target->tangent() ); diff --git a/ApplicationLibCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp b/ApplicationLibCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp index a788b6c0d3..7bfb14638c 100644 --- a/ApplicationLibCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp @@ -173,7 +173,7 @@ double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset( Rim3dWellLogCu } else { - double cellSize = m_gridView->ownerCase()->characteristicCellSize(); + double cellSize = m_gridView->characteristicCellSize(); double wellPathOffset = std::min( m_wellPath->wellPathRadius( cellSize ), 0.1 * planeWidth() ); return m_wellPath->wellPathRadius( cellSize ) + wellPathOffset; } @@ -186,7 +186,7 @@ double Riv3dWellLogPlanePartMgr::planeWidth() const { if ( !m_gridView ) return 0; - double cellSize = m_gridView->ownerCase()->characteristicCellSize(); + double cellSize = m_gridView->characteristicCellSize(); const Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection(); return cellSize * curveCollection->planeWidthScaling(); } diff --git a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp index c34dab3dcc..9e96ff708f 100644 --- a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp @@ -406,7 +406,7 @@ void RivSimWellPipesPartMgr::appendValvesGeo( const RimEclipseView* if ( !m_simWellInView || !m_simWellInView->isWellValvesVisible( frameIndex ) ) return; if ( !eclipseView || !eclipseView->ownerCase() ) return; - const auto characteristicCellSize = eclipseView->ownerCase()->characteristicCellSize(); + const auto characteristicCellSize = eclipseView->characteristicCellSize(); const auto coords = pbd.m_pipeGeomGenerator->pipeCenterCoords(); std::set> resultPointWithValve; diff --git a/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp index 6fea6b3bfa..dc69669e9a 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp @@ -173,7 +173,7 @@ void RivWellConnectionFactorPartMgr::appendDynamicGeometryPartsToModel( cvf::Mod if ( !completionVizDataItems.empty() ) { - double characteristicCellSize = eclView->ownerCase()->characteristicCellSize(); + double characteristicCellSize = eclView->characteristicCellSize(); double radius = m_rimWellPath->wellPathRadius( characteristicCellSize ) * m_virtualPerforationResult->geometryScaleFactor(); radius *= 2.0; // Enlarge the radius slightly to make the connection factor visible if geometry scale factor is diff --git a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp index be5e72ef7b..d89a3ea110 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp @@ -86,7 +86,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ RimSimWellInView* well = m_rimWell; - double characteristicCellSize = viewWithSettings()->ownerCase()->characteristicCellSize(); + double characteristicCellSize = viewWithSettings()->characteristicCellSize(); cvf::Vec3d whEndPos; cvf::Vec3d whStartPos; diff --git a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp index 0afc9af97d..8ed6dd9c9b 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -91,7 +91,7 @@ void RivWellFracturePartMgr::appendGeometryPartsToModel( cvf::ModelBasicList* mo m_visibleFracturePolygons.clear(); - double characteristicCellSize = eclView.ownerCase()->characteristicCellSize(); + double characteristicCellSize = eclView.characteristicCellSize(); cvf::Collection parts; RimMeshFractureTemplate* stimPlanFracTemplate = dynamic_cast( m_rimFracture->fractureTemplate() ); @@ -928,7 +928,7 @@ void RivWellFracturePartMgr::appendFracturePerforationLengthParts( const RimEcli auto displayCoordTransform = activeView.displayCoordTransform(); if ( displayCoordTransform.isNull() ) return; - double characteristicCellSize = activeView.ownerCase()->characteristicCellSize(); + double characteristicCellSize = activeView.characteristicCellSize(); double wellPathRadius = 1.0; { diff --git a/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp index eece88a5bf..83bbccdacc 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp @@ -78,7 +78,7 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t frameIndex, const caf::Displ RimSimWellInView* well = m_rimWell; - double characteristicCellSize = viewWithSettings()->ownerCase()->characteristicCellSize(); + double characteristicCellSize = viewWithSettings()->characteristicCellSize(); cvf::Vec3d whEndPos; cvf::Vec3d whStartPos; diff --git a/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp b/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp index 8ed281cfa6..36ab921eb7 100644 --- a/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp @@ -49,18 +49,30 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RivSurfacePartMgr::RivSurfacePartMgr( RimSurfaceInView* surface ) +RivSurfacePartMgr::RivSurfacePartMgr( RimSurfaceInView* surface, bool nativeOnly ) : m_surfaceInView( surface ) + , m_useNativePartsOnly( nativeOnly ) { CVF_ASSERT( surface ); - cvf::ref hexGrid = m_surfaceInView->createHexGridInterface(); - m_intersectionGenerator = new RivSurfaceIntersectionGeometryGenerator( m_surfaceInView, hexGrid.p() ); + if ( !nativeOnly ) + { + cvf::ref hexGrid = m_surfaceInView->createHexGridInterface(); + m_intersectionGenerator = new RivSurfaceIntersectionGeometryGenerator( m_surfaceInView, hexGrid.p() ); + } m_intersectionFacesTextureCoords = new cvf::Vec2fArray; m_nativeTrianglesTextureCoords = new cvf::Vec2fArray; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RivSurfacePartMgr::isNativePartMgr() const +{ + return m_useNativePartsOnly; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -369,8 +381,9 @@ void RivSurfacePartMgr::generatePartGeometry() //-------------------------------------------------------------------------------------------------- void RivSurfacePartMgr::generateNativePartGeometry() { - auto ownerCase = m_surfaceInView->firstAncestorOrThisOfTypeAsserted(); - cvf::Vec3d displayModOffsett = ownerCase->displayModelOffset(); + cvf::Vec3d displayModOffset( 0, 0, 0 ); + auto ownerCase = m_surfaceInView->firstAncestorOrThisOfType(); + if ( ownerCase ) displayModOffset = ownerCase->displayModelOffset(); m_usedSurfaceData = m_surfaceInView->surface()->surfaceData(); if ( m_usedSurfaceData.isNull() ) return; @@ -381,7 +394,7 @@ void RivSurfacePartMgr::generateNativePartGeometry() cvf::ref cvfVertices = new cvf::Vec3fArray( vertices.size() ); for ( size_t i = 0; i < vertices.size(); ++i ) { - ( *cvfVertices )[i] = cvf::Vec3f( vertices[i] - displayModOffsett ); + ( *cvfVertices )[i] = cvf::Vec3f( vertices[i] - displayModOffset ); } const std::vector& triangleIndices = m_usedSurfaceData->triangleIndices(); diff --git a/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.h b/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.h index 3516dba285..34ed50d3bd 100644 --- a/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.h +++ b/ApplicationLibCode/ModelVisualization/Surfaces/RivSurfacePartMgr.h @@ -41,7 +41,7 @@ class RivIntersectionGeometryGeneratorInterface; class RivSurfacePartMgr : public cvf::Object { public: - explicit RivSurfacePartMgr( RimSurfaceInView* surface ); + explicit RivSurfacePartMgr( RimSurfaceInView* surface, bool nativeOnly = false ); void updateNativeSurfaceColors(); void updateCellResultColor( int timeStepIndex ); @@ -53,11 +53,15 @@ public: const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const; + bool isNativePartMgr() const; + private: void generatePartGeometry(); void generateNativePartGeometry(); + bool m_useNativePartsOnly; + cvf::ref m_intersectionGenerator; caf::PdmPointer m_surfaceInView; diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp index 87cc7672d8..e02d4e9075 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp @@ -209,7 +209,7 @@ size_t RimAnnotationCollection::lineBasedAnnotationsCount() const //-------------------------------------------------------------------------------------------------- void RimAnnotationCollection::updateViewAnnotationCollections() { - auto views = gridViewsContainingAnnotations(); + auto views = viewsContainingAnnotations(); for ( const auto* view : views ) { diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp index be77fd4c7c..39ee3697c4 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp @@ -115,9 +115,7 @@ void RimAnnotationCollectionBase::onAnnotationDeleted() //-------------------------------------------------------------------------------------------------- void RimAnnotationCollectionBase::scheduleRedrawOfRelevantViews() { - // Todo: Do a Bounding Box check to see if this annotation actually is relevant for the view - - auto views = gridViewsContainingAnnotations(); + auto views = viewsContainingAnnotations(); if ( !views.empty() ) { for ( auto& view : views ) @@ -130,19 +128,13 @@ void RimAnnotationCollectionBase::scheduleRedrawOfRelevantViews() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimAnnotationCollectionBase::gridViewsContainingAnnotations() const +std::vector RimAnnotationCollectionBase::viewsContainingAnnotations() const { RimProject* project = RimProject::current(); if ( !project ) return {}; - std::vector views; - std::vector visibleGridViews; - project->allVisibleGridViews( visibleGridViews ); - - for ( auto& gridView : visibleGridViews ) - { - views.push_back( gridView ); - } + std::vector views; + project->allViews( views ); return views; } diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.h index 5f74326ef8..30a7fd0894 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.h @@ -27,7 +27,7 @@ class QString; class RimTextAnnotation; class RimAnnotationGroupCollection; -class RimGridView; +class Rim3dView; //================================================================================================== /// @@ -51,8 +51,8 @@ public: virtual void updateViewAnnotationCollections(); virtual void onAnnotationDeleted(); - void scheduleRedrawOfRelevantViews(); - std::vector gridViewsContainingAnnotations() const; + void scheduleRedrawOfRelevantViews(); + std::vector viewsContainingAnnotations() const; protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp index 06090aae1b..01134684d2 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp @@ -112,9 +112,7 @@ void RimAnnotationGroupCollection::fieldChangedByUi( const caf::PdmFieldHandle* if ( changedField == &m_isActive ) { updateUiIconFromToggleField(); - - auto coll = firstAncestorOrThisOfType(); - if ( coll ) coll->scheduleRedrawOfRelevantViews(); + updateViews(); } } @@ -125,3 +123,21 @@ caf::PdmFieldHandle* RimAnnotationGroupCollection::objectToggleField() { return &m_isActive; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAnnotationGroupCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, + std::vector& referringObjects ) +{ + updateViews(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAnnotationGroupCollection::updateViews() +{ + auto coll = firstAncestorOrThisOfType(); + if ( coll ) coll->scheduleRedrawOfRelevantViews(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.h index a0cccce966..67b2bbe151 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.h @@ -58,6 +58,10 @@ public: protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; caf::PdmFieldHandle* objectToggleField() override; + void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; + +private: + void updateViews(); protected: caf::PdmField m_isActive; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp index 1dff18db1f..a0cca82523 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp @@ -206,20 +206,6 @@ void RimGeoMechView::onLoadDataAndUpdate() progress.incrementProgress(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- - -void RimGeoMechView::onUpdateScaleTransform() -{ - cvf::Mat4d scale = cvf::Mat4d::IDENTITY; - scale( 2, 2 ) = scaleZ(); - - scaleTransform()->setLocalTransform( scale ); - - if ( nativeOrOverrideViewer() ) nativeOrOverrideViewer()->updateCachedValuesInScene(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -314,7 +300,7 @@ void RimGeoMechView::onCreateDisplayModel() cvf::BoundingBox femBBox = femParts()->boundingBox(); m_wellPathPipeVizModel->removeAllParts(); - addWellPathsToModel( m_wellPathPipeVizModel.p(), femBBox ); + addWellPathsToModel( m_wellPathPipeVizModel.p(), femBBox, ownerCase()->characteristicCellSize() ); nativeOrOverrideViewer()->addStaticModelOnce( m_wellPathPipeVizModel.p(), isUsingOverrideViewer() ); @@ -443,7 +429,7 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep() wellPathModelBasicList->setName( name ); cvf::BoundingBox femBBox = femParts()->boundingBox(); - addDynamicWellPathsToModel( wellPathModelBasicList.p(), femBBox ); + addDynamicWellPathsToModel( wellPathModelBasicList.p(), femBBox, ownerCase()->characteristicCellSize() ); frameScene->addModel( wellPathModelBasicList.p() ); } @@ -521,22 +507,6 @@ void RimGeoMechView::setGeoMechCase( RimGeoMechCase* gmCase ) cellFilterCollection()->setCase( gmCase ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimGeoMechView::onResetLegendsInViewer() -{ - for ( auto legendConfig : legendConfigs() ) - { - if ( legendConfig ) - { - legendConfig->recreateLegend(); - } - } - - nativeOrOverrideViewer()->removeAllColorLegends(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h index cfd4d96458..8672a055b9 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h @@ -133,16 +133,12 @@ protected: private: QString createAutoName() const override; - void onUpdateScaleTransform() override; - void onClampCurrentTimestep() override; size_t onTimeStepCountRequested() override; void onUpdateDisplayModelForCurrentTimeStep() override; void onUpdateStaticCellColors() override; - void onResetLegendsInViewer() override; - void onUpdateLegends() override; void updateTensorLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int viewerTimeStep ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp index 9b50e389cc..a5226cf1a5 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp @@ -112,11 +112,14 @@ QList RimIntersection::calculateValueOptions( const caf: if ( fieldNeedingOptions == &m_separateDataSource ) { - std::vector iResDefs = findSeparateResultsCollection()->intersectionResultsDefinitions(); - - for ( auto iresdef : iResDefs ) + if ( findSeparateResultsCollection() ) { - options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) ); + std::vector iResDefs = findSeparateResultsCollection()->intersectionResultsDefinitions(); + + for ( auto iresdef : iResDefs ) + { + options.push_back( caf::PdmOptionItemInfo( iresdef->autoName(), iresdef ) ); + } } } @@ -129,7 +132,8 @@ QList RimIntersection::calculateValueOptions( const caf: RimIntersectionResultsDefinitionCollection* RimIntersection::findSeparateResultsCollection() { auto view = firstAncestorOrThisOfTypeAsserted(); - return view->separateIntersectionResultsCollection(); + if ( view ) return view->separateIntersectionResultsCollection(); + return nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp index 85a5306860..3a468da404 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -792,19 +792,6 @@ void Rim2dIntersectionView::onUpdateStaticCellColors() { } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void Rim2dIntersectionView::onUpdateScaleTransform() -{ - cvf::Mat4d scale = cvf::Mat4d::IDENTITY; - scale( 2, 2 ) = scaleZ(); - - scaleTransform()->setLocalTransform( scale ); - - if ( nativeOrOverrideViewer() ) nativeOrOverrideViewer()->updateCachedValuesInScene(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h index 60601bcd0f..1613e55e03 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h @@ -84,7 +84,6 @@ protected: void onClampCurrentTimestep() override; void onUpdateDisplayModelForCurrentTimeStep() override; void onUpdateStaticCellColors() override; - void onUpdateScaleTransform() override; cvf::Transform* scaleTransform() override; void onResetLegendsInViewer() override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 4486c73d56..d81b519916 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -55,7 +55,10 @@ #include "RimGeoMechContourMapView.h" #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" +#include "RimGridView.h" #include "RimReservoirCellResultsStorage.h" +#include "RimSeismicData.h" +#include "RimSeismicView.h" #include "RimSimWellInViewCollection.h" #include "RiuViewer.h" @@ -157,6 +160,7 @@ RigHistogramData Rim3dOverlayInfoConfig::histogramData() auto geoMechView = dynamic_cast( m_viewDef.p() ); auto eclipseContourMap = dynamic_cast( eclipseView ); auto geoMechContourMap = dynamic_cast( geoMechView ); + auto seismicView = dynamic_cast( m_viewDef.p() ); if ( eclipseContourMap ) return m_histogramCalculator->histogramData( eclipseContourMap ); @@ -166,6 +170,10 @@ RigHistogramData Rim3dOverlayInfoConfig::histogramData() return m_histogramCalculator->histogramData( eclipseView, m_statisticsCellRange(), m_statisticsTimeRange() ); else if ( geoMechView ) return m_histogramCalculator->histogramData( geoMechView, m_statisticsCellRange(), m_statisticsTimeRange() ); + else if ( seismicView ) + { + return seismicView->histogramData(); + } return RigHistogramData(); } @@ -188,10 +196,14 @@ QString Rim3dOverlayInfoConfig::timeStepText() QString Rim3dOverlayInfoConfig::caseInfoText() { auto eclipseView = dynamic_cast( m_viewDef.p() ); - auto geoMechView = dynamic_cast( m_viewDef.p() ); - if ( eclipseView ) return caseInfoText( eclipseView ); + + auto geoMechView = dynamic_cast( m_viewDef.p() ); if ( geoMechView ) return caseInfoText( geoMechView ); + + auto seisView = dynamic_cast( m_viewDef.p() ); + if ( seisView ) return caseInfoText( seisView ); + return ""; } @@ -394,6 +406,36 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimGeoMechView* geoMechView ) return infoText; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString Rim3dOverlayInfoConfig::caseInfoText( RimSeismicView* seisView ) +{ + QString infoText; + + if ( seisView ) + { + auto seisData = seisView->seismicData(); + + if ( seisData ) + { + QString depthRange = QString( "%1 to %2" ).arg( seisData->zMin() ).arg( seisData->zMax() ); + QString zScale = QString::number( seisView->scaleZ() ); + QString ilineRange = QString( "%1 to %2" ).arg( seisData->inlineMin() ).arg( seisData->inlineMax() ); + QString xlineRange = QString( "%1 to %2" ).arg( seisData->xlineMin() ).arg( seisData->xlineMax() ); + QString seisName = QString::fromStdString( seisData->userDescription() ); + + infoText = QString( "

-- %1 --

" + "Depth Range: %2 Z-Scale: %3
" + "Inline Range: %4
" + "Xline Range: %5
" ) + .arg( seisName, depthRange, zScale, ilineRange, xlineRange ); + } + } + + return infoText; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -669,7 +711,8 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData //-------------------------------------------------------------------------------------------------- void Rim3dOverlayInfoConfig::showStatisticsInfoDialog( bool raise ) { - if ( m_viewDef ) + auto gridView = dynamic_cast( m_viewDef.p() ); + if ( gridView ) { RicGridStatisticsDialog* dialog = getOrCreateGridStatisticsDialog(); // Show dialog before setting data due to text edit auto height setting @@ -677,7 +720,7 @@ void Rim3dOverlayInfoConfig::showStatisticsInfoDialog( bool raise ) dialog->show(); dialog->setLabel( "Grid statistics" ); - dialog->updateFromRimView( m_viewDef ); + dialog->updateFromRimView( gridView ); if ( raise ) { @@ -735,7 +778,6 @@ void Rim3dOverlayInfoConfig::update3DInfo() } RimGeoMechView* geoMechView = dynamic_cast( m_viewDef.p() ); - if ( geoMechView ) { m_showVolumeWeightedMean = false; @@ -746,6 +788,15 @@ void Rim3dOverlayInfoConfig::update3DInfo() getOrCreateGridStatisticsDialog()->updateFromRimView( geoMechView ); } + RimSeismicView* seisView = dynamic_cast( m_viewDef.p() ); + if ( seisView ) + { + m_showVolumeWeightedMean = false; + m_showAnimProgress = false; + + updateSeismicInfo( seisView ); + } + update3DInfoIn2dViews(); } @@ -764,6 +815,17 @@ void Rim3dOverlayInfoConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiO { caf::PdmUiGroup* visGroup = uiOrdering.addNewGroup( "Visibility" ); + RimSeismicView* seisView = dynamic_cast( m_viewDef.p() ); + if ( seisView ) + { + visGroup->add( &m_showCaseInfo ); + visGroup->add( &m_showHistogram ); + visGroup->add( &m_showVersionInfo ); + + uiOrdering.skipRemainingFields( true ); + return; + } + RimEclipseView* eclipseView = dynamic_cast( m_viewDef.p() ); RimEclipseContourMapView* contourMap = dynamic_cast( eclipseView ); RimGeoMechView* geoMechView = dynamic_cast( m_viewDef.p() ); @@ -816,7 +878,7 @@ void Rim3dOverlayInfoConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiO //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dOverlayInfoConfig::setReservoirView( RimGridView* ownerReservoirView ) +void Rim3dOverlayInfoConfig::setReservoirView( Rim3dView* ownerReservoirView ) { m_viewDef = ownerReservoirView; } @@ -911,6 +973,41 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo( RimGeoMechView* geoMechView ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dOverlayInfoConfig::updateSeismicInfo( RimSeismicView* seisView ) +{ + RigHistogramData histData; + + if ( m_showResultInfo() || m_showHistogram() ) + { + histData = seisView->histogramData(); + } + + // Compose text + + QString infoText; + + if ( m_showCaseInfo() ) + { + infoText = caseInfoText( seisView ); + } + + seisView->viewer()->setInfoText( infoText ); + + // Populate histogram + + if ( m_showHistogram() ) + { + if ( histData.isHistogramVectorValid() ) + { + seisView->viewer()->showHistogram( true ); + seisView->viewer()->setHistogram( histData.min, histData.max, histData.histogram ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1009,11 +1106,13 @@ void Rim3dOverlayInfoConfig::displayPropertyFilteredStatisticsMessage( bool show //-------------------------------------------------------------------------------------------------- bool Rim3dOverlayInfoConfig::hasInvalidStatisticsCombination() { - if ( m_viewDef->propertyFilterCollection() && m_viewDef->propertyFilterCollection()->hasActiveDynamicFilters() && + auto gridView = dynamic_cast( m_viewDef.p() ); + + if ( gridView && gridView->propertyFilterCollection() && gridView->propertyFilterCollection()->hasActiveDynamicFilters() && m_statisticsCellRange() == RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS && m_statisticsTimeRange() == RimHistogramCalculator::StatisticsTimeRangeType::ALL_TIMESTEPS ) { - RimEclipseView* eclipseView = dynamic_cast( m_viewDef.p() ); + RimEclipseView* eclipseView = dynamic_cast( gridView ); if ( !( eclipseView && eclipseView->cellResult()->isFlowDiagOrInjectionFlooding() ) ) // If // isFlowDiagOrInjFlooding // then skip this check as diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index 7bfdc7cfa1..81a47d0eee 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -39,8 +39,9 @@ class RimGeoMechContourMapView; class RimEclipseContourMapView; class RimEclipseView; class RimGeoMechView; -class RimGridView; +class Rim3dView; class RicGridStatisticsDialog; +class RimSeismicView; //================================================================================================== /// @@ -56,7 +57,7 @@ public: void update3DInfo(); - void setReservoirView( RimGridView* ownerView ); + void setReservoirView( Rim3dView* ownerView ); void setPosition( cvf::Vec2ui position ); @@ -82,11 +83,13 @@ private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void updateEclipse3DInfo( RimEclipseView* reservoirView ); void updateGeoMech3DInfo( RimGeoMechView* geoMechView ); + void updateSeismicInfo( RimSeismicView* seisView ); void update3DInfoIn2dViews() const; QString timeStepText( RimEclipseView* eclipseView ); QString timeStepText( RimGeoMechView* geoMechView ); QString caseInfoText( RimEclipseView* eclipseView ); QString caseInfoText( RimGeoMechView* geoMechView ); + QString caseInfoText( RimSeismicView* seisView ); QString resultInfoText( const RigHistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean ); QString resultInfoText( const RigHistogramData& histData, RimGeoMechView* geoMechView ); @@ -107,8 +110,8 @@ private: caf::PdmField> m_statisticsTimeRange; caf::PdmField> m_statisticsCellRange; - caf::PdmPointer m_viewDef; - cvf::Vec2ui m_position; + caf::PdmPointer m_viewDef; + cvf::Vec2ui m_position; std::unique_ptr m_histogramCalculator; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 0636e4140f..ec37eb8060 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -30,12 +30,15 @@ #include "RicfCommandObject.h" #include "Rim3dWellLogCurve.h" +#include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimCase.h" #include "RimCellFilterCollection.h" #include "RimGridView.h" +#include "RimLegendConfig.h" #include "RimMainPlotCollection.h" #include "RimMeasurement.h" +#include "RimOilField.h" #include "RimProject.h" #include "RimTools.h" #include "RimViewController.h" @@ -164,7 +167,7 @@ Rim3dView::Rim3dView() m_cellfilterPartManager = new RivCellFilterPartMgr( this ); m_measurementPartManager = new RivMeasurementPartMgr( this ); - setAs3DViewMdiWindow(); + this->setAs3DViewMdiWindow(); // Every timer tick, send a signal for updating animations. // Any animation is supposed to connect to this signal @@ -198,9 +201,9 @@ Rim3dView::~Rim3dView() } } - if ( isMasterView() ) + if ( this->isMasterView() ) { - RimViewLinker* viewLinker = assosiatedViewLinker(); + RimViewLinker* viewLinker = this->assosiatedViewLinker(); viewLinker->setMasterView( nullptr ); delete proj->viewLinkerCollection->viewLinker(); @@ -209,7 +212,7 @@ Rim3dView::~Rim3dView() proj->uiCapability()->updateConnectedEditors(); } - RimViewController* vController = viewController(); + RimViewController* vController = this->viewController(); if ( vController ) { vController->setManagedView( nullptr ); @@ -359,7 +362,7 @@ QWidget* Rim3dView::createViewWidget( QWidget* mainWindowParent ) cvf::String yLabel; cvf::String zLabel; - defineAxisLabels( &xLabel, &yLabel, &zLabel ); + this->defineAxisLabels( &xLabel, &yLabel, &zLabel ); m_viewer->setAxisLabels( xLabel, yLabel, zLabel ); updateZScaleLabel(); @@ -400,7 +403,7 @@ void Rim3dView::setId( int id ) { m_id = id; QString viewIdTooltip = QString( "View id: %1" ).arg( m_id ); - setUiToolTip( viewIdTooltip ); + this->setUiToolTip( viewIdTooltip ); } //-------------------------------------------------------------------------------------------------- @@ -441,7 +444,7 @@ void Rim3dView::updateMdiWindowTitle() //-------------------------------------------------------------------------------------------------- RimViewLinker* Rim3dView::assosiatedViewLinker() const { - RimViewLinker* viewLinker = viewLinkerIfMasterView(); + RimViewLinker* viewLinker = this->viewLinkerIfMasterView(); if ( !viewLinker ) { RimViewController* viewController = this->viewController(); @@ -502,7 +505,7 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" ); gridGroup->add( &m_scaleZ ); - m_scaleZ.uiCapability()->setUiReadOnly( !isScaleZEditable() ); + m_scaleZ.uiCapability()->setUiReadOnly( !this->isScaleZEditable() ); gridGroup->add( &meshMode ); gridGroup->add( &surfaceMode ); @@ -533,9 +536,9 @@ QImage Rim3dView::snapshotWindowContent() void Rim3dView::scheduleCreateDisplayModelAndRedraw() { RiaViewRedrawScheduler::instance()->scheduleDisplayModelUpdateAndRedraw( this ); - if ( isMasterView() ) + if ( this->isMasterView() ) { - RimViewLinker* viewLinker = assosiatedViewLinker(); + RimViewLinker* viewLinker = this->assosiatedViewLinker(); if ( viewLinker ) { viewLinker->scheduleCreateDisplayModelAndRedrawForDependentViews(); @@ -579,7 +582,7 @@ std::set Rim3dView::viewsUsingThisAsComparisonView() //-------------------------------------------------------------------------------------------------- bool Rim3dView::isScaleZEditable() { - return ( viewsUsingThisAsComparisonView().empty() || ( viewController() && viewController()->isCameraLinked() ) ); + return ( this->viewsUsingThisAsComparisonView().empty() || ( this->viewController() && this->viewController()->isCameraLinked() ) ); } //-------------------------------------------------------------------------------------------------- @@ -610,7 +613,7 @@ bool Rim3dView::isTimeStepDependentDataVisibleInThisOrComparisonView() const //-------------------------------------------------------------------------------------------------- size_t Rim3dView::timeStepCount() { - return onTimeStepCountRequested(); + return this->onTimeStepCountRequested(); } //-------------------------------------------------------------------------------------------------- @@ -618,9 +621,9 @@ size_t Rim3dView::timeStepCount() //-------------------------------------------------------------------------------------------------- QString Rim3dView::timeStepName( int frameIdx ) const { - if ( ownerCase() ) + if ( this->ownerCase() ) { - return ownerCase()->timeStepName( frameIdx ); + return this->ownerCase()->timeStepName( frameIdx ); } return QString( "" ); } @@ -638,7 +641,7 @@ void Rim3dView::setCurrentTimeStep( int frameIndex ) if ( m_currentTimeStep != oldTimeStep ) { RiuTimeStepChangedHandler::instance()->handleTimeStepChanged( this ); - onClearReservoirCellVisibilitiesIfNecessary(); + this->onClearReservoirCellVisibilitiesIfNecessary(); } } @@ -660,7 +663,7 @@ void Rim3dView::updateDisplayModelForCurrentTimeStepAndRedraw() if ( nativeOrOverrideViewer() ) { - onUpdateDisplayModelForCurrentTimeStep(); + this->onUpdateDisplayModelForCurrentTimeStep(); appendAnnotationsToModel(); appendMeasurementToModel(); appendCellFiltersToModel(); @@ -680,7 +683,7 @@ void Rim3dView::updateDisplayModelForCurrentTimeStepAndRedraw() m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw = true; - std::set containerViews = viewsUsingThisAsComparisonView(); + std::set containerViews = this->viewsUsingThisAsComparisonView(); if ( !containerViews.empty() && !isUsingOverrideViewer() ) { for ( auto view : containerViews ) @@ -701,7 +704,7 @@ void Rim3dView::createDisplayModelAndRedraw() { if ( nativeOrOverrideViewer() ) { - onClampCurrentTimestep(); + this->onClampCurrentTimestep(); onUpdateScaleTransform(); @@ -774,7 +777,7 @@ void Rim3dView::setDefaultView() { if ( m_viewer ) { - m_viewer->setDefaultView(); + m_viewer->setDefaultView( -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS ); } } @@ -783,7 +786,7 @@ void Rim3dView::setDefaultView() //-------------------------------------------------------------------------------------------------- void Rim3dView::endAnimation() { - onUpdateStaticCellColors(); + this->onUpdateStaticCellColors(); } //-------------------------------------------------------------------------------------------------- @@ -936,7 +939,7 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const RiuMainWindow::instance()->updateScaleValue(); - RimViewLinker* viewLinker = assosiatedViewLinker(); + RimViewLinker* viewLinker = this->assosiatedViewLinker(); if ( viewLinker ) { viewLinker->updateScaleZ( this, scaleZ() ); @@ -995,8 +998,8 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const fontHolder->updateFonts(); } } - applyBackgroundColorAndFontChanges(); - updateConnectedEditors(); + this->applyBackgroundColorAndFontChanges(); + this->updateConnectedEditors(); } else if ( changedField == &maximumFrameRate ) { @@ -1024,15 +1027,15 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox ) +void Rim3dView::addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox, + double characteristicCellSize ) { - if ( !ownerCase() ) return; - cvf::ref transForm = displayCoordTransform(); m_wellPathsPartManager->appendStaticGeometryPartsToModel( wellPathModelBasicList, transForm.p(), - ownerCase()->characteristicCellSize(), + characteristicCellSize, wellPathClipBoundingBox ); wellPathModelBasicList->updateBoundingBoxesRecursive(); @@ -1041,17 +1044,17 @@ void Rim3dView::addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox ) +void Rim3dView::addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox, + double characteristicCellSize ) { - if ( !ownerCase() ) return; - cvf::ref transForm = displayCoordTransform(); size_t timeStepIndex = currentTimeStep(); m_wellPathsPartManager->appendDynamicGeometryPartsToModel( wellPathModelBasicList, timeStepIndex, transForm.p(), - ownerCase()->characteristicCellSize(), + characteristicCellSize, wellPathClipBoundingBox ); wellPathModelBasicList->updateBoundingBoxesRecursive(); @@ -1062,18 +1065,14 @@ void Rim3dView::addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBa //-------------------------------------------------------------------------------------------------- void Rim3dView::addAnnotationsToModel( cvf::ModelBasicList* annotationsModel ) { - if ( !ownerCase() ) return; - auto annotationCollections = descendantsIncludingThisOfType(); - if ( annotationCollections.empty() || !annotationCollections.front()->isActive() ) - { - m_annotationsPartManager->clearGeometryCache(); - } - else + m_annotationsPartManager->clearGeometryCache(); + + if ( !annotationCollections.empty() && annotationCollections.front()->isActive() ) { cvf::ref transForm = displayCoordTransform(); - m_annotationsPartManager->appendGeometryPartsToModel( annotationsModel, transForm.p(), ownerCase()->allCellsBoundingBox() ); + m_annotationsPartManager->appendGeometryPartsToModel( annotationsModel, transForm.p(), domainBoundingBox() ); } annotationsModel->updateBoundingBoxesRecursive(); @@ -1084,7 +1083,7 @@ void Rim3dView::addAnnotationsToModel( cvf::ModelBasicList* annotationsModel ) //-------------------------------------------------------------------------------------------------- void Rim3dView::addCellFiltersToModel( cvf::ModelBasicList* cellFilterModel ) { - if ( !ownerCase() ) return; + if ( !this->ownerCase() ) return; cvf::ref transForm = displayCoordTransform(); m_cellfilterPartManager->appendGeometryPartsToModel( cellFilterModel, transForm.p(), ownerCase()->allCellsBoundingBox() ); @@ -1097,7 +1096,7 @@ void Rim3dView::addCellFiltersToModel( cvf::ModelBasicList* cellFilterModel ) //-------------------------------------------------------------------------------------------------- void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* measureModel ) { - if ( !ownerCase() ) return; + if ( !this->ownerCase() ) return; RimMeasurement* measurement = RimProject::current()->measurement(); @@ -1124,7 +1123,7 @@ void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* measureModel ) //---------------------------------------------------- ---------------------------------------------- bool Rim3dView::isMasterView() const { - RimViewLinker* viewLinker = assosiatedViewLinker(); + RimViewLinker* viewLinker = this->assosiatedViewLinker(); return viewLinker && this == viewLinker->masterView(); } @@ -1197,7 +1196,7 @@ void Rim3dView::setScaleZAndUpdate( double scalingFactor ) { if ( scaleZ() != scalingFactor ) { - m_scaleZ.setValueWithFieldChanged( scalingFactor ); + this->m_scaleZ.setValueWithFieldChanged( scalingFactor ); } } @@ -1230,8 +1229,8 @@ void Rim3dView::updateScaling() dir = viewer()->mainCamera()->direction(); up = viewer()->mainCamera()->up(); - eye[2] = poi[2] * m_scaleZ() / scaleTransform()->worldTransform()( 2, 2 ) + ( eye[2] - poi[2] ); - poi[2] = poi[2] * m_scaleZ() / scaleTransform()->worldTransform()( 2, 2 ); + eye[2] = poi[2] * m_scaleZ() / this->scaleTransform()->worldTransform()( 2, 2 ) + ( eye[2] - poi[2] ); + poi[2] = poi[2] * m_scaleZ() / this->scaleTransform()->worldTransform()( 2, 2 ); viewer()->mainCamera()->setFromLookAt( eye, eye + dir, up ); viewer()->setPointOfInterest( poi ); @@ -1246,7 +1245,7 @@ void Rim3dView::updateScaling() updateGridBoxData(); updateZScaleLabel(); - scheduleCreateDisplayModelAndRedraw(); + this->scheduleCreateDisplayModelAndRedraw(); } //-------------------------------------------------------------------------------------------------- @@ -1355,7 +1354,7 @@ void Rim3dView::applyBackgroundColorAndFontChanges() updateConnectedEditors(); onUpdateLegends(); - scheduleCreateDisplayModelAndRedraw(); + this->scheduleCreateDisplayModelAndRedraw(); } //-------------------------------------------------------------------------------------------------- @@ -1431,7 +1430,7 @@ void Rim3dView::updateDisplayModelVisibility() viewer()->setEnableMask( mask, false ); viewer()->setEnableMask( mask, true ); - onUpdateDisplayModelVisibility(); + this->onUpdateDisplayModelVisibility(); viewer()->update(); } @@ -1627,7 +1626,7 @@ void Rim3dView::appendAnnotationsToModel() if ( frameScene ) { cvf::String name = "Annotations"; - removeModelByName( frameScene, name ); + this->removeModelByName( frameScene, name ); cvf::ref model = new cvf::ModelBasicList; model->setName( name ); @@ -1649,7 +1648,7 @@ void Rim3dView::appendCellFiltersToModel() if ( frameScene ) { cvf::String name = "CellFilters"; - removeModelByName( frameScene, name ); + this->removeModelByName( frameScene, name ); cvf::ref model = new cvf::ModelBasicList; model->setName( name ); @@ -1671,7 +1670,7 @@ void Rim3dView::appendMeasurementToModel() if ( frameScene ) { cvf::String name = "Measurement"; - removeModelByName( frameScene, name ); + this->removeModelByName( frameScene, name ); cvf::ref model = new cvf::ModelBasicList; model->setName( name ); @@ -1748,3 +1747,78 @@ RimViewLinker* Rim3dView::viewLinkerIfMasterView() const return nullptr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::onResetLegendsInViewer() +{ + for ( auto legendConfig : legendConfigs() ) + { + if ( legendConfig ) legendConfig->recreateLegend(); + } + + auto viewer = nativeOrOverrideViewer(); + if ( viewer ) viewer->removeAllColorLegends(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::onUpdateScaleTransform() +{ + if ( scaleTransform() ) + { + cvf::Mat4d scale = cvf::Mat4d::IDENTITY; + scale( 2, 2 ) = scaleZ(); + + scaleTransform()->setLocalTransform( scale ); + + if ( nativeOrOverrideViewer() ) nativeOrOverrideViewer()->updateCachedValuesInScene(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::updateSurfacesInViewTreeItems() +{ + // default is to do nothing +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double Rim3dView::characteristicCellSize() const +{ + if ( ownerCase() ) + { + return ownerCase()->characteristicCellSize(); + } + + return 1.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimAnnotationInViewCollection* Rim3dView::annotationCollection() const +{ + return m_annotationCollection; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::syncronizeLocalAnnotationsFromGlobal() +{ + RimProject* proj = RimProject::current(); + if ( proj && proj->activeOilField() ) + { + RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection(); + if ( annotColl && annotationCollection() ) + { + annotationCollection()->onGlobalCollectionChanged( annotColl ); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index af1ca70e7f..e87831424f 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -44,6 +44,7 @@ class RimCase; class RimLegendConfig; class RimWellPathCollection; +class RimAnnotationInViewCollection; class RiuViewer; class RivAnnotationsPartMgr; class RivMeasurementPartMgr; @@ -117,14 +118,15 @@ public: virtual RiaDefines::View3dContent viewContent() const = 0; - void setMeshOnlyDrawstyle(); - void setMeshSurfDrawstyle(); - void setSurfOnlyDrawstyle(); - void setFaultMeshSurfDrawstyle(); - void setSurfaceDrawstyle(); - void setShowGridBox( bool showGridBox ); - virtual bool isShowingActiveCellsOnly(); - virtual bool isGridVisualizationMode() const = 0; + void setMeshOnlyDrawstyle(); + void setMeshSurfDrawstyle(); + void setSurfOnlyDrawstyle(); + void setFaultMeshSurfDrawstyle(); + void setSurfaceDrawstyle(); + void setShowGridBox( bool showGridBox ); + virtual bool isShowingActiveCellsOnly(); + virtual bool isGridVisualizationMode() const = 0; + virtual double characteristicCellSize() const; void setBackgroundColor( const cvf::Color3f& newBackgroundColor ); cvf::Color3f backgroundColor() const override; // Implementation of RiuViewerToViewInterface @@ -165,11 +167,11 @@ public: void updateDisplayModelForCurrentTimeStepAndRedraw(); void createHighlightAndGridBoxDisplayModelAndRedraw(); void createMeasurementDisplayModelAndRedraw(); - void updateGridBoxData(); void updateAnnotationItems(); void resetLegends(); - cvf::BoundingBox domainBoundingBox(); + virtual void updateGridBoxData(); + virtual cvf::BoundingBox domainBoundingBox(); void setScaleZ( double scaleZ ); void setScaleZAndUpdate( double scaleZ ); @@ -187,6 +189,11 @@ public: RimViewLinker* assosiatedViewLinker() const override; RimViewController* viewController() const override; + virtual void updateSurfacesInViewTreeItems(); + + RimAnnotationInViewCollection* annotationCollection() const; + void syncronizeLocalAnnotationsFromGlobal(); + protected: static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName ); @@ -203,8 +210,12 @@ protected: RimWellPathCollection* wellPathCollection() const; - void addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox ); - void addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox ); + void addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox, + double characteristicCellSize ); + void addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox, + double characteristicCellSize ); void addAnnotationsToModel( cvf::ModelBasicList* annotationsModel ); void addMeasurementToModel( cvf::ModelBasicList* measureModel ); void addCellFiltersToModel( cvf::ModelBasicList* cellFilterModel ); @@ -218,22 +229,23 @@ protected: // Abstract methods to implement in subclasses + virtual void onUpdateDisplayModelVisibility(){}; + virtual void onClearReservoirCellVisibilitiesIfNecessary(){}; + virtual void onResetLegendsInViewer(); + virtual void onUpdateScaleTransform(); + virtual void onCreateDisplayModel() = 0; virtual void onUpdateDisplayModelForCurrentTimeStep() = 0; - virtual void onUpdateDisplayModelVisibility(){}; - virtual void onClampCurrentTimestep() = 0; - virtual size_t onTimeStepCountRequested() = 0; + virtual void onClampCurrentTimestep() = 0; + virtual size_t onTimeStepCountRequested() = 0; - virtual void onClearReservoirCellVisibilitiesIfNecessary(){}; virtual bool isTimeStepDependentDataVisible() const = 0; virtual void defineAxisLabels( cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel ) = 0; virtual void onCreatePartCollectionFromSelection( cvf::Collection* parts ) = 0; virtual void onUpdateStaticCellColors() = 0; - virtual void onResetLegendsInViewer() = 0; virtual void onUpdateLegends() = 0; - virtual void onUpdateScaleTransform() = 0; - virtual cvf::Transform* scaleTransform() = 0; + virtual cvf::Transform* scaleTransform() = 0; protected: caf::PdmFieldHandle* userDescriptionField() override; @@ -259,10 +271,13 @@ protected: cvf::ref m_wellPathPipeVizModel; cvf::ref m_seismicVizModel; cvf::ref m_wellPathsPartManager; + cvf::ref m_highlightVizModel; caf::PdmField m_scaleZ; caf::PdmField m_customScaleZ; + caf::PdmChildField m_annotationCollection; + private: friend class RimProject; @@ -288,9 +303,9 @@ private: // Pure private methods void createHighlightAndGridBoxDisplayModel(); - void appendAnnotationsToModel(); void appendMeasurementToModel(); void appendCellFiltersToModel(); + void appendAnnotationsToModel(); // Pure private methods : Override viewer and comparison view @@ -320,7 +335,6 @@ private: caf::PdmField m_fontSize; // 3D display model data - cvf::ref m_highlightVizModel; cvf::ref m_annotationsPartManager; cvf::ref m_measurementPartManager; cvf::ref m_cellfilterPartManager; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index ed48aed30d..446137c388 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -116,6 +116,7 @@ #include "RimSeismicData.h" #include "RimSeismicDataCollection.h" #include "RimSeismicSectionCollection.h" +#include "RimSeismicViewCollection.h" #include "RimSimWellFracture.h" #include "RimSimWellInView.h" #include "RimSimWellInViewCollection.h" @@ -1055,6 +1056,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicImportSeismicFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicNewSeismicViewFeature"; + } else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateTextAnnotationFeature"; @@ -1245,6 +1250,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() } else if ( dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicNewSeismicViewFeature"; + menuBuilder.addSeparator(); menuBuilder << "RicNewSeismicDifferenceFeature"; } else if ( dynamic_cast( firstUiItem ) ) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index cb5b5fe691..e008ae6365 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -613,7 +613,7 @@ void RimEclipseView::onCreateDisplayModel() // as the fracture geometry depends on the StimPlan legend colors fractureColors()->updateLegendData(); - addWellPathsToModel( m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox() ); + addWellPathsToModel( m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox(), ownerCase()->characteristicCellSize() ); m_wellPathsPartManager->appendStaticFracturePartsToModel( m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox() ); m_wellPathPipeVizModel->updateBoundingBoxesRecursive(); @@ -936,7 +936,9 @@ void RimEclipseView::appendWellsAndFracturesToModel() cvf::ref wellPathModelBasicList = new cvf::ModelBasicList; wellPathModelBasicList->setName( name ); - addDynamicWellPathsToModel( wellPathModelBasicList.p(), currentActiveCellInfo()->geometryBoundingBox() ); + addDynamicWellPathsToModel( wellPathModelBasicList.p(), + currentActiveCellInfo()->geometryBoundingBox(), + ownerCase()->characteristicCellSize() ); frameScene->addModel( wellPathModelBasicList.p() ); } @@ -1599,22 +1601,6 @@ void RimEclipseView::syncronizeWellsWithResults() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEclipseView::syncronizeLocalAnnotationsFromGlobal() -{ - RimProject* proj = RimProject::current(); - if ( proj && proj->activeOilField() ) - { - RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection(); - if ( annotColl && annotationCollection() ) - { - annotationCollection()->onGlobalCollectionChanged( annotColl ); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2059,22 +2045,6 @@ void RimEclipseView::setCurrentCellResultData( const std::vector& values } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEclipseView::onResetLegendsInViewer() -{ - for ( auto legendConfig : legendConfigs() ) - { - if ( legendConfig ) - { - legendConfig->recreateLegend(); - } - } - - nativeOrOverrideViewer()->removeAllColorLegends(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.h b/ApplicationLibCode/ProjectDataModel/RimEclipseView.h index 17a2c7b12b..a7d5218d05 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.h @@ -160,8 +160,6 @@ public: std::vector legendConfigs() const override; cvf::Color4f colorFromCellCategory( RivCellSetEnum geometryType ) const; - void syncronizeLocalAnnotationsFromGlobal(); - std::vector additionalResultsForResultInfo() const; protected: @@ -203,7 +201,6 @@ private: RimEclipseResultDefinition* eclResDef, int timeStepIndex ); - void onResetLegendsInViewer() override; void updateVirtualConnectionLegendRanges(); void updateFaultColors(); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp index 1fb994045b..eebb57a5af 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp @@ -19,7 +19,6 @@ #include "RimGridView.h" #include "Rim3dOverlayInfoConfig.h" -#include "RimAnnotationInViewCollection.h" #include "RimCellFilterCollection.h" #include "RimEclipseCase.h" #include "RimEclipseResultDefinition.h" @@ -235,14 +234,6 @@ const RimCellFilterCollection* RimGridView::cellFilterCollection() const } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimAnnotationInViewCollection* RimGridView::annotationCollection() const -{ - return m_annotationCollection; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridView.h b/ApplicationLibCode/ProjectDataModel/RimGridView.h index 58d3cea41b..f3115e2f34 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridView.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridView.h @@ -22,7 +22,6 @@ #include "cvfArray.h" -class RimAnnotationInViewCollection; class RimEclipseContourMapProjection; class Rim3dOverlayInfoConfig; class RimIntersectionCollection; @@ -53,7 +52,6 @@ public: virtual RimSurfaceInViewCollection* surfaceInViewCollection() const; RimIntersectionResultsDefinitionCollection* separateIntersectionResultsCollection() const; RimIntersectionResultsDefinitionCollection* separateSurfaceResultsCollection() const; - RimAnnotationInViewCollection* annotationCollection() const; RimWellMeasurementInViewCollection* measurementCollection() const; RimSeismicSectionCollection* seismicSectionCollection() const; @@ -70,7 +68,7 @@ public: bool isGridVisualizationMode() const override; void updateWellMeasurements(); - void updateSurfacesInViewTreeItems(); + void updateSurfacesInViewTreeItems() override; protected: virtual void updateViewFollowingCellFilterUpdates(); @@ -101,7 +99,6 @@ protected: caf::PdmChildField m_overlayInfoConfig; caf::PdmChildField m_gridCollection; - caf::PdmChildField m_annotationCollection; caf::PdmChildField m_wellMeasurementCollection; caf::PdmChildField m_surfaceCollection; caf::PdmChildField m_cellFilterCollection; diff --git a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp index cba9663526..f0f421c609 100644 --- a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp @@ -30,6 +30,7 @@ #include "RimMeasurement.h" #include "RimObservedDataCollection.h" #include "RimSeismicDataCollection.h" +#include "RimSeismicViewCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSurfaceCollection.h" #include "RimWellPathCollection.h" @@ -65,8 +66,11 @@ RimOilField::RimOilField() surfaceCollection = new RimSurfaceCollection(); surfaceCollection->setAsTopmostFolder(); - CAF_PDM_InitFieldNoDefault( &seismicCollection, "SeismicCollection", "Seismic Data" ); - seismicCollection = new RimSeismicDataCollection(); + CAF_PDM_InitFieldNoDefault( &seismicDataCollection, "SeismicCollection", "Seismic Data" ); + seismicDataCollection = new RimSeismicDataCollection(); + + CAF_PDM_InitFieldNoDefault( &seismicViewCollection, "SeismicViewCollection", "Seismic Views" ); + seismicViewCollection = new RimSeismicViewCollection(); completionTemplateCollection = new RimCompletionTemplateCollection; analysisModels = new RimEclipseCaseCollection(); diff --git a/ApplicationLibCode/ProjectDataModel/RimOilField.h b/ApplicationLibCode/ProjectDataModel/RimOilField.h index e8429123af..a45ed80936 100644 --- a/ApplicationLibCode/ProjectDataModel/RimOilField.h +++ b/ApplicationLibCode/ProjectDataModel/RimOilField.h @@ -38,6 +38,7 @@ class RimWellPathCollection; class RimAnnotationCollection; class RimMeasurement; class RimSeismicDataCollection; +class RimSeismicViewCollection; class RimSurfaceCollection; class RimEnsembleWellLogsCollection; @@ -69,7 +70,8 @@ public: caf::PdmChildField annotationCollection; caf::PdmChildField measurement; caf::PdmChildField surfaceCollection; - caf::PdmChildField seismicCollection; + caf::PdmChildField seismicDataCollection; + caf::PdmChildField seismicViewCollection; caf::PdmChildField ensembleWellLogsCollection; protected: diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 5d1d3539fc..43e5fccfc0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -73,6 +73,8 @@ #include "RimSaturationPressurePlotCollection.h" #include "RimScriptCollection.h" #include "RimSeismicDataCollection.h" +#include "RimSeismicView.h" +#include "RimSeismicViewCollection.h" #include "RimStimPlanModelPlotCollection.h" #include "RimSummaryCalculation.h" #include "RimSummaryCalculationCollection.h" @@ -811,6 +813,18 @@ void RimProject::allViews( std::vector& views ) const } } } + + for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ ) + { + RimOilField* oilField = oilFields[oilFieldIdx]; + if ( !oilField ) continue; + if ( !oilField->seismicViewCollection() ) continue; + + for ( auto seisview : oilField->seismicViewCollection()->views() ) + { + views.push_back( seisview ); + } + } } //-------------------------------------------------------------------------------------------------- @@ -869,6 +883,11 @@ void RimProject::scheduleCreateDisplayModelAndRedrawAllViews() views[viewIdx]->scheduleCreateDisplayModelAndRedraw(); } } + + for ( auto seisview : activeOilField()->seismicViewCollection()->views() ) + { + seisview->scheduleCreateDisplayModelAndRedraw(); + } } //-------------------------------------------------------------------------------------------------- @@ -1520,7 +1539,12 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q if ( oilField->geoMechModels() ) uiTreeOrdering.add( oilField->geoMechModels() ); if ( oilField->wellPathCollection() ) uiTreeOrdering.add( oilField->wellPathCollection() ); if ( oilField->surfaceCollection() ) uiTreeOrdering.add( oilField->surfaceCollection() ); - if ( oilField->seismicCollection() ) uiTreeOrdering.add( oilField->seismicCollection() ); + if ( oilField->seismicDataCollection() ) + { + auto child = uiTreeOrdering.add( "Seismic", ":/Seismic16x16.png" ); + child->add( oilField->seismicDataCollection() ); + child->add( oilField->seismicViewCollection() ); + } if ( oilField->formationNamesCollection() ) uiTreeOrdering.add( oilField->formationNamesCollection() ); if ( oilField->completionTemplateCollection() ) uiTreeOrdering.add( oilField->completionTemplateCollection() ); if ( oilField->annotationCollection() ) uiTreeOrdering.add( oilField->annotationCollection() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimTools.cpp b/ApplicationLibCode/ProjectDataModel/RimTools.cpp index 4c6bc5f180..46c1622456 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTools.cpp @@ -384,7 +384,7 @@ void RimTools::seismicDataOptionItems( QList* options ) 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() ) { @@ -403,7 +403,7 @@ void RimTools::seismicDataOptionItems( QList* options, c 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() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Seismic/CMakeLists_files.cmake index 3fde3e6ed6..0cfb1872c9 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Seismic/CMakeLists_files.cmake @@ -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}) diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp index db62e81096..8e50260143 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp @@ -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" ); diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp index 0ec1089931..76f7523d59 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp @@ -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 ); diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.cpp index 7afc20c106..1e1661913d 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.cpp @@ -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 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 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 ); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.h b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.h index acf8a02485..4b990003a4 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.h +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataInterface.h @@ -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: diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDifferenceData.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDifferenceData.cpp index df9c9242b1..a472caba85 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDifferenceData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDifferenceData.cpp @@ -506,7 +506,7 @@ QList 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() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp index 32ffe7c986..9c89a1fe37 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp @@ -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 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 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; diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSectionCollection.cpp index 9e57e36389..09bbe122bb 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSectionCollection.cpp @@ -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(); } diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp new file mode 100644 index 0000000000..c02e59e305 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp @@ -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 +// 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 RimSeismicView::legendConfigs() const +{ + std::vector 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 mainScene = new cvf::Scene; + + // Seismic sections + + cvf::ref 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 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* 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 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 RimSeismicView::polyLinesData() const +{ + cvf::ref 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 RimSeismicView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList 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; +} diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.h b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.h new file mode 100644 index 0000000000..20685ee92e --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.h @@ -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 +// 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 legendConfigs() const override; + void scheduleGeometryRegen( RivCellSetEnum geometryType ) override; + + cvf::BoundingBox domainBoundingBox() override; + void updateGridBoxData() override; + double characteristicCellSize() const override; + RigHistogramData histogramData(); + + cvf::ref 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 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* 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 m_surfaceCollection; + caf::PdmChildField m_seismicSectionCollection; + + caf::PdmChildField m_overlayInfoConfig; + + caf::PdmPtrField m_seismicData; + + cvf::ref m_surfaceVizModel; + cvf::ref m_polylinePartMgr; + + cvf::ref m_scaleTransform; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicViewCollection.cpp new file mode 100644 index 0000000000..3517715d6b --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicViewCollection.cpp @@ -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 +// 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 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; +} diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicViewCollection.h b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicViewCollection.h new file mode 100644 index 0000000000..bfb625758a --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicViewCollection.h @@ -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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiaSeismicDefines.h" + +#include "cafPdmField.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmObject.h" + +#include + +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 views() const; + +private: + caf::PdmChildArrayField m_views; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index e36bcd231b..fbecda8977 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -299,18 +299,15 @@ void RimSurfaceCollection::updateViews( const std::vector& surfsToR { RimProject* proj = RimProject::current(); + // Make sure the tree items are synchronized std::vector views; proj->allViews( views ); - - // Make sure the tree items are synchronized - for ( auto view : views ) { - auto gridView = dynamic_cast( view ); - if ( gridView ) gridView->updateSurfacesInViewTreeItems(); + view->updateSurfacesInViewTreeItems(); } - std::set viewsNeedingUpdate; + std::set viewsNeedingUpdate; for ( auto surf : surfsToReload ) { @@ -320,7 +317,7 @@ void RimSurfaceCollection::updateViews( const std::vector& surfsToR surfInView->clearGeometry(); surfInView->surfaceResultDefinition()->legendConfig()->setShowLegend( showLegend ); - auto gridView = surfInView->firstAncestorOrThisOfType(); + auto gridView = surfInView->firstAncestorOrThisOfType(); if ( gridView ) viewsNeedingUpdate.insert( gridView ); } } @@ -346,9 +343,9 @@ void RimSurfaceCollection::updateViews( const std::vector& surfsToR //-------------------------------------------------------------------------------------------------- void RimSurfaceCollection::updateViews() { - RimProject* proj = RimProject::current(); - std::vector views; - proj->allVisibleGridViews( views ); + RimProject* proj = RimProject::current(); + std::vector views; + proj->allViews( views ); // Make sure the tree items are synchronized diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp index 4f4c18f55c..95bfb8be9e 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp @@ -141,6 +141,20 @@ RivSurfacePartMgr* RimSurfaceInView::surfacePartMgr() return m_surfacePartMgr.p(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RivSurfacePartMgr* RimSurfaceInView::nativeSurfacePartMgr() +{ + bool nativeOnly = true; + if ( m_surfacePartMgr.isNull() || !m_surfacePartMgr->isNativePartMgr() ) + { + m_surfacePartMgr = new RivSurfacePartMgr( this, nativeOnly ); + } + + return m_surfacePartMgr.p(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -221,7 +235,7 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField if ( scheduleRedraw ) { - auto ownerView = firstAncestorOrThisOfTypeAsserted(); + auto ownerView = firstAncestorOrThisOfTypeAsserted(); ownerView->scheduleCreateDisplayModelAndRedraw(); } } @@ -242,8 +256,12 @@ void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin //-------------------------------------------------------------------------------------------------- RimIntersectionResultsDefinitionCollection* RimSurfaceInView::findSeparateResultsCollection() { - auto view = firstAncestorOrThisOfTypeAsserted(); - return view->separateSurfaceResultsCollection(); + auto view = firstAncestorOrThisOfType(); + if ( view ) + { + return view->separateSurfaceResultsCollection(); + } + return nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.h b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.h index 205c8a8a90..a94dbd5ca7 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.h +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.h @@ -53,6 +53,7 @@ public: void clearGeometry(); RivSurfacePartMgr* surfacePartMgr(); + RivSurfacePartMgr* nativeSurfacePartMgr(); const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const override; void loadDataAndUpdate(); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp index 247726762f..0d7db550ba 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp @@ -18,6 +18,7 @@ #include "RimSurfaceInViewCollection.h" +#include "Rim3dView.h" #include "RimEnsembleSurface.h" #include "RimGridView.h" #include "RimIntersectionResultDefinition.h" @@ -51,7 +52,7 @@ RimSurfaceInViewCollection::RimSurfaceInViewCollection() CAF_PDM_InitFieldNoDefault( &m_collectionsInView, "SurfacesInViewFieldCollections", "SurfacesInViewFieldCollections" ); m_collectionsInView.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "SurfacesInViewField" ); + CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "Surfaces" ); m_surfacesInView.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceCollectionRef", "SurfaceCollection" ); @@ -279,7 +280,7 @@ void RimSurfaceInViewCollection::clearGeometry() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSurfaceInViewCollection::appendPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform ) +void RimSurfaceInViewCollection::appendPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform, bool onlyNativeParts ) { if ( !isChecked() ) return; @@ -287,7 +288,7 @@ void RimSurfaceInViewCollection::appendPartsToModel( cvf::ModelBasicList* model, { if ( coll->isChecked() ) { - coll->appendPartsToModel( model, scaleTransform ); + coll->appendPartsToModel( model, scaleTransform, onlyNativeParts ); } } @@ -295,7 +296,14 @@ void RimSurfaceInViewCollection::appendPartsToModel( cvf::ModelBasicList* model, { if ( surf->isActive() ) { - surf->surfacePartMgr()->appendIntersectionGeometryPartsToModel( model, scaleTransform ); + if ( onlyNativeParts ) + { + surf->nativeSurfacePartMgr()->appendNativeGeometryPartsToModel( model, scaleTransform ); + } + else + { + surf->surfacePartMgr()->appendIntersectionGeometryPartsToModel( model, scaleTransform ); + } } } @@ -311,7 +319,7 @@ void RimSurfaceInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* ch if ( changedField == &m_isChecked ) { - auto ownerView = firstAncestorOrThisOfTypeAsserted(); + auto ownerView = firstAncestorOrThisOfTypeAsserted(); ownerView->scheduleCreateDisplayModelAndRedraw(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h index aeb25fe83e..494b772867 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h @@ -57,7 +57,7 @@ public: void loadData(); void clearGeometry(); - void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform ); + void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform, bool onlyNativeParts = false ); void updateCellResultColor( bool hasGeneralCellResult, int timeStepIndex ); void applySingleColorEffect(); diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index e6d99204af..0631d1a31c 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -252,7 +252,7 @@ void RiuViewer::clearRimView() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuViewer::setDefaultView() +void RiuViewer::setDefaultView( const cvf::Vec3d& dir, const cvf::Vec3d& up ) { cvf::BoundingBox bb = m_mainRendering->boundingBox(); if ( !bb.isValid() ) @@ -273,7 +273,7 @@ void RiuViewer::setDefaultView() } } - m_mainCamera->fitView( bb, -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS ); + m_mainCamera->fitView( bb, dir, up ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuViewer.h b/ApplicationLibCode/UserInterface/RiuViewer.h index 0e55dfe9ac..c22fc0cfd2 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.h +++ b/ApplicationLibCode/UserInterface/RiuViewer.h @@ -79,7 +79,7 @@ public: RiuViewer( const RiuViewer& ) = delete; void clearRimView(); - void setDefaultView(); + void setDefaultView( const cvf::Vec3d& dir, const cvf::Vec3d& up ); cvf::Vec3d pointOfInterest(); void setPointOfInterest( cvf::Vec3d poi ); void setOwnerReservoirView( RiuViewerToViewInterface* owner ); diff --git a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp index 84d07f1b40..8c37f592d3 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp @@ -60,7 +60,9 @@ #include "RimLegendConfig.h" #include "RimPerforationInterval.h" #include "RimProject.h" +#include "RimSeismicDataInterface.h" #include "RimSeismicSection.h" +#include "RimSeismicView.h" #include "RimSimWellInView.h" #include "RimStimPlanFractureTemplate.h" #include "RimSurfaceInView.h" @@ -171,6 +173,8 @@ void RiuViewerCommands::addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBu RimProject::current()->allViews( views ); for ( auto view : views ) { + if ( dynamic_cast( view ) ) continue; + if ( view != mainGridView ) { validComparisonViews.push_back( view ); @@ -263,6 +267,13 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event ) // Check type of view + RimSeismicView* seisView = dynamic_cast( mainOrComparisonView ); + if ( seisView ) + { + // no context menu support in seismic views, yet + return; + } + RimGridView* gridView = dynamic_cast( mainOrComparisonView ); Rim2dIntersectionView* int2dView = dynamic_cast( mainOrComparisonView ); @@ -1211,7 +1222,15 @@ bool RiuViewerCommands::handleOverlayItemPicking( int winPosX, int winPosY ) { if ( legendConfig && legendConfig->titledOverlayFrame() == pickedOverlayItem ) { - RiuMainWindow::instance()->selectAsCurrentItem( legendConfig ); + auto seisInterface = legendConfig->firstAncestorOfType(); + if ( seisInterface != nullptr ) + { + RiuMainWindow::instance()->selectAsCurrentItem( seisInterface ); + } + else + { + RiuMainWindow::instance()->selectAsCurrentItem( legendConfig ); + } return true; }