Skip to content

Commit 8185d76

Browse files
committed
Testing
1 parent a0dbbf6 commit 8185d76

File tree

12 files changed

+268
-1
lines changed

12 files changed

+268
-1
lines changed

ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
set(SOURCE_GROUP_HEADER_FILES
22
${CMAKE_CURRENT_LIST_DIR}/RicApplyUserDefinedCameraFeature.h
33
${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.h
4+
${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.h
5+
${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.h
46
)
57

68
set(SOURCE_GROUP_SOURCE_FILES
79
${CMAKE_CURRENT_LIST_DIR}/RicApplyUserDefinedCameraFeature.cpp
810
${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.cpp
11+
${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.cpp
12+
${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.cpp
913
)
1014

1115
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2026 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#include "RicPopOutTo3dViewFeature.h"
20+
21+
#include "RiaGuiApplication.h"
22+
23+
#include "RimGridView.h"
24+
#include "RiuMainWindow.h"
25+
26+
#include "RiuViewer.h"
27+
28+
#include "cafSelectionManager.h"
29+
30+
#include <QAction>
31+
#include <QSettings>
32+
33+
CAF_CMD_SOURCE_INIT( RicPopOutTo3dViewFeature, "RicPopOutTo3dViewFeature" );
34+
35+
//--------------------------------------------------------------------------------------------------
36+
///
37+
//--------------------------------------------------------------------------------------------------
38+
bool RicPopOutTo3dViewFeature::isCommandEnabled() const
39+
{
40+
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
41+
{
42+
return !view->isDockingViewer();
43+
}
44+
return false;
45+
46+
//--------------------------------------------------------------------------------------------------
47+
///
48+
//--------------------------------------------------------------------------------------------------
49+
void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked )
50+
{
51+
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
52+
{
53+
view->convertToDocking( RiaGuiApplication::instance()->mainWindow() );
54+
}
55+
}
56+
57+
//--------------------------------------------------------------------------------------------------
58+
///
59+
//--------------------------------------------------------------------------------------------------
60+
void RicPopOutTo3dViewFeature::setupActionLook( QAction * actionToSetup )
61+
{
62+
actionToSetup->setText( "Pop Out (in 3D View)" );
63+
actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) );
64+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2026 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#pragma once
20+
21+
#include "cafCmdFeature.h"
22+
23+
//==================================================================================================
24+
///
25+
//==================================================================================================
26+
class RicPopOutTo3dViewFeature : public caf::CmdFeature
27+
{
28+
CAF_CMD_HEADER_INIT;
29+
30+
protected:
31+
bool isCommandEnabled() const override;
32+
void onActionTriggered( bool isChecked ) override;
33+
void setupActionLook( QAction* actionToSetup ) override;
34+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2026 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#include "RicPopOutToPlotViewFeature.h"
20+
21+
#include "RiaGuiApplication.h"
22+
23+
#include "RimGridView.h"
24+
#include "RiuMainWindow.h"
25+
26+
#include "RiuViewer.h"
27+
28+
#include "cafSelectionManager.h"
29+
30+
#include <QAction>
31+
#include <QSettings>
32+
33+
CAF_CMD_SOURCE_INIT( RicPopOutToPlotViewFeature, "RicPopOutToPlotViewFeature" );
34+
35+
//--------------------------------------------------------------------------------------------------
36+
///
37+
//--------------------------------------------------------------------------------------------------
38+
bool RicPopOutToPlotViewFeature::isCommandEnabled() const
39+
{
40+
return true;
41+
}
42+
43+
//--------------------------------------------------------------------------------------------------
44+
///
45+
//--------------------------------------------------------------------------------------------------
46+
void RicPopOutToPlotViewFeature::onActionTriggered( bool isChecked )
47+
{
48+
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
49+
{
50+
view->convertToDocking( RiaGuiApplication::instance()->mainPlotWindow() );
51+
}
52+
}
53+
54+
//--------------------------------------------------------------------------------------------------
55+
///
56+
//--------------------------------------------------------------------------------------------------
57+
void RicPopOutToPlotViewFeature::setupActionLook( QAction* actionToSetup )
58+
{
59+
actionToSetup->setText( "Pop Out (in Plot View)" );
60+
actionToSetup->setIcon( QIcon( ":/PlotWindow.svg" ) );
61+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2026 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#pragma once
20+
21+
#include "cafCmdFeature.h"
22+
23+
//==================================================================================================
24+
///
25+
//==================================================================================================
26+
class RicPopOutToPlotViewFeature : public caf::CmdFeature
27+
{
28+
CAF_CMD_HEADER_INIT;
29+
30+
protected:
31+
bool isCommandEnabled() const override;
32+
void onActionTriggered( bool isChecked ) override;
33+
void setupActionLook( QAction* actionToSetup ) override;
34+
};

ApplicationLibCode/ProjectDataModel/Rim3dView.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "RiaApplication.h"
2323
#include "RiaFieldHandleTools.h"
24+
#include "RiaGuiApplication.h"
2425
#include "RiaOptionItemFactory.h"
2526
#include "RiaPreferences.h"
2627
#include "RiaPreferencesSystem.h"
@@ -52,12 +53,14 @@
5253
#include "RiuTimeStepChangedHandler.h"
5354
#include "RiuViewer.h"
5455

56+
#include "cafCmdFeatureMenuBuilder.h"
5557
#include "cafDisplayCoordTransform.h"
5658
#include "cafFrameAnimationControl.h"
5759
#include "cafPdmFieldScriptingCapability.h"
5860
#include "cafPdmFieldScriptingCapabilityCvfColor3.h"
5961
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
6062
#include "cafPdmUiComboBoxEditor.h"
63+
6164
#include "cvfCamera.h"
6265
#include "cvfModelBasicList.h"
6366
#include "cvfPart.h"
@@ -1868,3 +1871,34 @@ void Rim3dView::synchronizeLocalAnnotationsFromGlobal()
18681871
}
18691872
}
18701873
}
1874+
1875+
//--------------------------------------------------------------------------------------------------
1876+
///
1877+
//--------------------------------------------------------------------------------------------------
1878+
void Rim3dView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
1879+
{
1880+
if ( isDockingViewer() )
1881+
{
1882+
}
1883+
else
1884+
{
1885+
menuBuilder << "RicPopOutTo3dViewFeature";
1886+
menuBuilder << "RicPopOutToPlotViewFeature";
1887+
}
1888+
}
1889+
1890+
//--------------------------------------------------------------------------------------------------
1891+
///
1892+
//--------------------------------------------------------------------------------------------------
1893+
void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow )
1894+
{
1895+
if ( isDockingViewer() ) return;
1896+
1897+
removeMdiWindowFromMdiArea();
1898+
1899+
QWidget* viewWidget = createViewWidget( nullptr );
1900+
1901+
mainWindow->initializeDockingViewer( viewWidget );
1902+
updateViewWidgetAfterCreation();
1903+
scheduleCreateDisplayModelAndRedraw();
1904+
}

ApplicationLibCode/ProjectDataModel/Rim3dView.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class RiuViewer;
5353
class RivAnnotationsPartMgr;
5454
class RivMeasurementPartMgr;
5555
class RivWellPathsPartMgr;
56+
class RiuMainWindowBase;
5657
class RimViewNameConfig;
5758

5859
namespace cvf
@@ -95,6 +96,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
9596

9697
int id() const final;
9798

99+
bool isDockingViewer() const { return m_isDockingViewer; }
100+
98101
// Public fields:
99102

100103
caf::PdmField<bool> isPerspectiveView;
@@ -200,6 +203,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
200203
RimAnnotationInViewCollection* annotationCollection() const;
201204
void synchronizeLocalAnnotationsFromGlobal();
202205

206+
void convertToDocking( RiuMainWindowBase* mainWindow );
207+
203208
protected:
204209
static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName );
205210

@@ -253,6 +258,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
253258

254259
void onViewNavigationChanged() override;
255260

261+
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
262+
256263
protected:
257264
caf::PdmFieldHandle* userDescriptionField() override;
258265
caf::PdmFieldHandle* backgroundColorField();
@@ -323,7 +330,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
323330
QPointer<RiuViewer> m_viewer;
324331
QPointer<RiuViewer> m_overrideViewer;
325332
bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views
326-
// are pointing to each other.
333+
// are pointing to each other.
327334

328335
// Fields
329336
caf::PdmField<int> m_id;
@@ -356,4 +363,6 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
356363
std::unique_ptr<QTimer> m_animationTimer;
357364
const int m_animationIntervalMillisec;
358365
int m_animationTimerUsers;
366+
367+
bool m_isDockingViewer;
359368
};

ApplicationLibCode/UserInterface/RiuMainWindow.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,18 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer,
12731273
slotRefreshViewActions();
12741274
}
12751275

1276+
//--------------------------------------------------------------------------------------------------
1277+
///
1278+
//--------------------------------------------------------------------------------------------------
1279+
void RiuMainWindow::initializeDockingViewer( QWidget* viewer )
1280+
{
1281+
auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() );
1282+
dockViewer->setWidget( viewer );
1283+
dockManager()->addDockWidgetFloating( dockViewer );
1284+
1285+
slotRefreshViewActions();
1286+
}
1287+
12761288
//--------------------------------------------------------------------------------------------------
12771289
/// This method needs to handle memory deallocation !!!
12781290
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/UserInterface/RiuMainWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ class RiuMainWindow : public RiuMainWindowBase
101101
void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override;
102102
void setActiveViewer( QWidget* subWindow ) override;
103103

104+
void initializeDockingViewer( QWidget* viewer ) override;
105+
104106
void setResultInfo( const QString& info ) const;
105107

106108
void refreshViewActions();

ApplicationLibCode/UserInterface/RiuMainWindowBase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class RiuMainWindowBase : public QMainWindow
7272
virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0;
7373
virtual void setActiveViewer( QWidget* subWindow ) = 0;
7474

75+
virtual void initializeDockingViewer( QWidget* viewer ) = 0;
76+
7577
virtual QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) = 0;
7678

7779
RimMdiWindowGeometry windowGeometryForViewer( QWidget* viewer );

0 commit comments

Comments
 (0)