This commit is contained in:
jonjenssen authored and JJ committed 2026-06-17 13:55:32 +02:00
1 parent 602415e86d
commit cc9a075fc6
12 files changed
+266 -1

No files matched your search

@@ -1,6 +1,8 @@
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicApplyUserDefinedCameraFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.cpp
)
list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicPopOutTo3dViewFeature.h"
#include "RiaGuiApplication.h"
#include "RimGridView.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QSettings>
CAF_CMD_SOURCE_INIT( RicPopOutTo3dViewFeature, "RicPopOutTo3dViewFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPopOutTo3dViewFeature::isCommandEnabled() const
{
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
{
return !view->isDockingViewer();
}
return false;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked )
{
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
{
view->convertToDocking( RiaGuiApplication::instance()->mainWindow() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPopOutTo3dViewFeature::setupActionLook( QAction * actionToSetup )
{
actionToSetup->setText( "Pop Out (in 3D View)" );
actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) );
}
@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicPopOutTo3dViewFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicPopOutToPlotViewFeature.h"
#include "RiaGuiApplication.h"
#include "RimGridView.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QSettings>
CAF_CMD_SOURCE_INIT( RicPopOutToPlotViewFeature, "RicPopOutToPlotViewFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPopOutToPlotViewFeature::isCommandEnabled() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPopOutToPlotViewFeature::onActionTriggered( bool isChecked )
{
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
{
view->convertToDocking( RiaGuiApplication::instance()->mainPlotWindow() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPopOutToPlotViewFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Pop Out (in Plot View)" );
actionToSetup->setIcon( QIcon( ":/PlotWindow.svg" ) );
}
@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicPopOutToPlotViewFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -21,6 +21,7 @@
#include "RiaApplication.h"
#include "RiaFieldHandleTools.h"
#include "RiaGuiApplication.h"
#include "RiaOptionItemFactory.h"
#include "RiaPreferences.h"
#include "RiaPreferencesSystem.h"
@@ -52,12 +53,14 @@
#include "RiuTimeStepChangedHandler.h"
#include "RiuViewer.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafDisplayCoordTransform.h"
#include "cafFrameAnimationControl.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapabilityCvfColor3.h"
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cvfCamera.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
@@ -1897,3 +1900,34 @@ void Rim3dView::synchronizeLocalAnnotationsFromGlobal()
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
{
if ( isDockingViewer() )
{
}
else
{
menuBuilder << "RicPopOutTo3dViewFeature";
menuBuilder << "RicPopOutToPlotViewFeature";
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow )
{
if ( isDockingViewer() ) return;
removeMdiWindowFromMdiArea();
QWidget* viewWidget = createViewWidget( nullptr );
mainWindow->initializeDockingViewer( viewWidget );
updateViewWidgetAfterCreation();
scheduleCreateDisplayModelAndRedraw();
}
@@ -53,6 +53,7 @@ class RiuViewer;
class RivAnnotationsPartMgr;
class RivMeasurementPartMgr;
class RivWellPathsPartMgr;
class RiuMainWindowBase;
class RimViewNameConfig;
namespace cvf
@@ -95,6 +96,8 @@ public:
int id() const final;
bool isDockingViewer() const { return m_isDockingViewer; }
// Public fields:
caf::PdmField<bool> isPerspectiveView;
@@ -203,6 +206,8 @@ public:
RimAnnotationInViewCollection* annotationCollection() const;
void synchronizeLocalAnnotationsFromGlobal();
void convertToDocking( RiuMainWindowBase* mainWindow );
protected:
static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName );
@@ -256,6 +261,8 @@ protected:
void onViewNavigationChanged() override;
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
protected:
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* backgroundColorField();
@@ -326,7 +333,7 @@ private:
QPointer<RiuViewer> m_viewer;
QPointer<RiuViewer> m_overrideViewer;
bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views
// are pointing to each other.
// are pointing to each other.
// Fields
caf::PdmField<int> m_id;
@@ -359,4 +366,6 @@ private:
std::unique_ptr<QTimer> m_animationTimer;
const int m_animationIntervalMillisec;
int m_animationTimerUsers;
bool m_isDockingViewer;
};
@@ -1274,6 +1274,18 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer,
slotRefreshViewActions();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::initializeDockingViewer( QWidget* viewer )
{
auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() );
dockViewer->setWidget( viewer );
dockManager()->addDockWidgetFloating( dockViewer );
slotRefreshViewActions();
}
//--------------------------------------------------------------------------------------------------
/// This method needs to handle memory deallocation !!!
//--------------------------------------------------------------------------------------------------
@@ -101,6 +101,8 @@ public:
void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override;
void setActiveViewer( QWidget* subWindow ) override;
void initializeDockingViewer( QWidget* viewer ) override;
void setResultInfo( const QString& info ) const;
void refreshViewActions();
@@ -72,6 +72,8 @@ public:
virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0;
virtual void setActiveViewer( QWidget* subWindow ) = 0;
virtual void initializeDockingViewer( QWidget* viewer ) = 0;
virtual QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) = 0;
RimMdiWindowGeometry windowGeometryForViewer( QWidget* viewer );
@@ -865,6 +865,16 @@ void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* vie
refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::initializeDockingViewer( QWidget* viewer )
{
auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() );
dockViewer->setWidget( viewer );
dockManager()->addDockWidgetFloating( dockViewer );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -71,6 +71,7 @@ public:
void removeViewer( QWidget* viewer ) override;
void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override;
void setActiveViewer( QWidget* subWindow ) override;
void initializeDockingViewer( QWidget* viewer ) override;
void setDefaultWindowSize();
void enable3DSelectionLink( bool enable );