diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml
index 63e4c4586c..6c7baa128e 100644
--- a/.github/workflows/ResInsightWithCache.yml
+++ b/.github/workflows/ResInsightWithCache.yml
@@ -50,16 +50,6 @@ jobs:
build-python-module: true,
execute-unit-tests: true,
}
- - {
- name: "Mac OS",
- os: macos-latest,
- cc: "clang",
- cxx: "clang++",
- vcpkg-response-file: vcpkg_x64-osx.txt,
- vcpkg-triplet: x64-osx,
- build-python-module: false,
- execute-unit-tests: false,
- }
steps:
- name: Checkout
uses: actions/checkout@v2
diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt
index 3e57febf37..443e6c5b40 100644
--- a/ApplicationExeCode/CMakeLists.txt
+++ b/ApplicationExeCode/CMakeLists.txt
@@ -21,15 +21,11 @@ endif()
# Open GL
find_package(OpenGL)
-find_package(
- Qt5
- COMPONENTS Core
- QUIET
-)
+find_package(Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core)
if(Qt5Core_FOUND)
find_package(
- Qt5
+ Qt5 ${RI_QT_MINIMUM_VERSION}
COMPONENTS Core
Gui
OpenGL
@@ -68,9 +64,9 @@ endif()
# Defining all the source (and header) files
# ##############################################################################
-set(CODE_HEADER_FILES)
+set(CODE_HEADER_FILES RiaMainTools.h)
-set(CODE_SOURCE_FILES RiaMain.cpp)
+set(CODE_SOURCE_FILES RiaMain.cpp RiaMainTools.cpp)
if(RESINSIGHT_ENABLE_GRPC)
list(APPEND CODE_HEAD_FILES RiaGrpcConsoleApplication.h
@@ -210,12 +206,6 @@ if(MSVC)
set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005")
- if(Qt5Core_VERSION_STRING GREATER_EQUAL 5.10)
- # Disable warning for deprecated functions in newer versions of Qt
- # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-160
- set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996")
- endif()
-
if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
# The following warning is generated over 800 times from a qwt header only
# using VS2015 Disabling temporarily warning C4505 'function' : unreferenced
diff --git a/ApplicationExeCode/Resources/AppendNext.png b/ApplicationExeCode/Resources/AppendNext.png
new file mode 100644
index 0000000000..1073b89a23
Binary files /dev/null and b/ApplicationExeCode/Resources/AppendNext.png differ
diff --git a/ApplicationExeCode/Resources/AppendNext.svg b/ApplicationExeCode/Resources/AppendNext.svg
new file mode 100644
index 0000000000..4a3bf78a69
--- /dev/null
+++ b/ApplicationExeCode/Resources/AppendNext.svg
@@ -0,0 +1,74 @@
+
+
+
+
diff --git a/ApplicationExeCode/Resources/AppendNextCurve.png b/ApplicationExeCode/Resources/AppendNextCurve.png
new file mode 100644
index 0000000000..46ca68fa25
Binary files /dev/null and b/ApplicationExeCode/Resources/AppendNextCurve.png differ
diff --git a/ApplicationExeCode/Resources/AppendNextCurve.svg b/ApplicationExeCode/Resources/AppendNextCurve.svg
new file mode 100644
index 0000000000..b29ed3db85
--- /dev/null
+++ b/ApplicationExeCode/Resources/AppendNextCurve.svg
@@ -0,0 +1,70 @@
+
+
+
+
diff --git a/ApplicationExeCode/Resources/AppendPrev.png b/ApplicationExeCode/Resources/AppendPrev.png
new file mode 100644
index 0000000000..33d26afaf1
Binary files /dev/null and b/ApplicationExeCode/Resources/AppendPrev.png differ
diff --git a/ApplicationExeCode/Resources/AppendPrev.svg b/ApplicationExeCode/Resources/AppendPrev.svg
new file mode 100644
index 0000000000..2aa05757cd
--- /dev/null
+++ b/ApplicationExeCode/Resources/AppendPrev.svg
@@ -0,0 +1,63 @@
+
+
+
+
diff --git a/ApplicationExeCode/Resources/AppendPrevCurve.png b/ApplicationExeCode/Resources/AppendPrevCurve.png
new file mode 100644
index 0000000000..ebbac2239c
Binary files /dev/null and b/ApplicationExeCode/Resources/AppendPrevCurve.png differ
diff --git a/ApplicationExeCode/Resources/AppendPrevCurve.svg b/ApplicationExeCode/Resources/AppendPrevCurve.svg
new file mode 100644
index 0000000000..4c864605c9
--- /dev/null
+++ b/ApplicationExeCode/Resources/AppendPrevCurve.svg
@@ -0,0 +1,69 @@
+
+
+
+
diff --git a/ApplicationExeCode/Resources/AxesSync16x16.png b/ApplicationExeCode/Resources/AxesSync16x16.png
new file mode 100644
index 0000000000..3d6480f791
Binary files /dev/null and b/ApplicationExeCode/Resources/AxesSync16x16.png differ
diff --git a/ApplicationExeCode/Resources/CheckOverlay16x16.png b/ApplicationExeCode/Resources/CheckOverlay16x16.png
new file mode 100644
index 0000000000..23979cd107
Binary files /dev/null and b/ApplicationExeCode/Resources/CheckOverlay16x16.png differ
diff --git a/ApplicationExeCode/Resources/DataVector.png b/ApplicationExeCode/Resources/DataVector.png
new file mode 100644
index 0000000000..17778a1002
Binary files /dev/null and b/ApplicationExeCode/Resources/DataVector.png differ
diff --git a/ApplicationExeCode/Resources/DisableZoom.png b/ApplicationExeCode/Resources/DisableZoom.png
new file mode 100644
index 0000000000..5f14b04504
Binary files /dev/null and b/ApplicationExeCode/Resources/DisableZoom.png differ
diff --git a/ApplicationExeCode/Resources/DisableZoom.svg b/ApplicationExeCode/Resources/DisableZoom.svg
new file mode 100644
index 0000000000..1afcab49eb
--- /dev/null
+++ b/ApplicationExeCode/Resources/DisableZoom.svg
@@ -0,0 +1,70 @@
+
+
diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc
index 36cf73cb3c..f0ce42be12 100644
--- a/ApplicationExeCode/Resources/ResInsight.qrc
+++ b/ApplicationExeCode/Resources/ResInsight.qrc
@@ -13,6 +13,7 @@
AnalysisPlotFilter16x16.png
AppLogo48x48.png
Axes16x16.png
+ AxesSync16x16.png
BottomAxis16x16.png
Bullet.png
CascadeWindows.svg
@@ -145,6 +146,7 @@
SummaryPlots16x16.png
SummaryPlotsLight16x16.png
SummaryTemplate16x16.png
+ SummaryEnsembleTemplate16x16.png
SummaryXPlotLight16x16.png
SummaryXPlotsLight16x16.png
Swap.png
@@ -240,6 +242,33 @@
ComboBoxDown.svg
ComboBoxUp.svg
WellIntAnalysis.png
+ DataVector.png
+ data-sources.svg
+ edit.svg
+ graph.svg
+ messages.svg
+ multiplot.svg
+ plot-manager.svg
+ plots.svg
+ property-editor.svg
+ scripts.svg
+ standard.svg
+ summary-plot.svg
+ undo-stack.svg
+ view.svg
+ view-snapshots.svg
+ well-log-plot.svg
+ window-management.svg
+ DisableZoom.png
+ AppendNext.svg
+ AppendPrev.svg
+ AppendNext.png
+ AppendPrev.png
+ AppendNextCurve.svg
+ AppendPrevCurve.svg
+ AppendNextCurve.png
+ AppendPrevCurve.png
+ CheckOverlay16x16.png
fs_CellFace.glsl
diff --git a/ApplicationExeCode/Resources/SummaryEnsembleTemplate16x16.png b/ApplicationExeCode/Resources/SummaryEnsembleTemplate16x16.png
new file mode 100644
index 0000000000..cac7f2e6bb
Binary files /dev/null and b/ApplicationExeCode/Resources/SummaryEnsembleTemplate16x16.png differ
diff --git a/ApplicationExeCode/Resources/ZoomAll.svg b/ApplicationExeCode/Resources/ZoomAll.svg
index 306d8cb4e7..5aa7e97096 100644
--- a/ApplicationExeCode/Resources/ZoomAll.svg
+++ b/ApplicationExeCode/Resources/ZoomAll.svg
@@ -1,5 +1,53 @@
-
-
\ No newline at end of file
+
+
diff --git a/ApplicationExeCode/Resources/data-sources.svg b/ApplicationExeCode/Resources/data-sources.svg
new file mode 100644
index 0000000000..19a6b13dbc
--- /dev/null
+++ b/ApplicationExeCode/Resources/data-sources.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/edit.svg b/ApplicationExeCode/Resources/edit.svg
new file mode 100644
index 0000000000..08f6b38e54
--- /dev/null
+++ b/ApplicationExeCode/Resources/edit.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/graph.svg b/ApplicationExeCode/Resources/graph.svg
new file mode 100644
index 0000000000..40a5c774f6
--- /dev/null
+++ b/ApplicationExeCode/Resources/graph.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/messages.svg b/ApplicationExeCode/Resources/messages.svg
new file mode 100644
index 0000000000..1d3be011f8
--- /dev/null
+++ b/ApplicationExeCode/Resources/messages.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/multiplot.svg b/ApplicationExeCode/Resources/multiplot.svg
new file mode 100644
index 0000000000..b4fb3c0af0
--- /dev/null
+++ b/ApplicationExeCode/Resources/multiplot.svg
@@ -0,0 +1,12 @@
+
+
+
diff --git a/ApplicationExeCode/Resources/plot-manager.svg b/ApplicationExeCode/Resources/plot-manager.svg
new file mode 100644
index 0000000000..1f5e31274e
--- /dev/null
+++ b/ApplicationExeCode/Resources/plot-manager.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/plots.svg b/ApplicationExeCode/Resources/plots.svg
new file mode 100644
index 0000000000..40a5c774f6
--- /dev/null
+++ b/ApplicationExeCode/Resources/plots.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/property-editor.svg b/ApplicationExeCode/Resources/property-editor.svg
new file mode 100644
index 0000000000..a9b9ee76b0
--- /dev/null
+++ b/ApplicationExeCode/Resources/property-editor.svg
@@ -0,0 +1,6 @@
+
diff --git a/ApplicationExeCode/Resources/scripts.svg b/ApplicationExeCode/Resources/scripts.svg
new file mode 100644
index 0000000000..5f29574b2d
--- /dev/null
+++ b/ApplicationExeCode/Resources/scripts.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/standard.svg b/ApplicationExeCode/Resources/standard.svg
new file mode 100644
index 0000000000..bc321cdffa
--- /dev/null
+++ b/ApplicationExeCode/Resources/standard.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/summary-plot.svg b/ApplicationExeCode/Resources/summary-plot.svg
new file mode 100644
index 0000000000..5b1a8abbb8
--- /dev/null
+++ b/ApplicationExeCode/Resources/summary-plot.svg
@@ -0,0 +1,19 @@
+
+
+
diff --git a/ApplicationExeCode/Resources/themes/default.qss b/ApplicationExeCode/Resources/themes/default.qss
index 0304d4cc46..45893da97c 100644
--- a/ApplicationExeCode/Resources/themes/default.qss
+++ b/ApplicationExeCode/Resources/themes/default.qss
@@ -84,6 +84,10 @@ QwtPlot["PvtPlot"]::lineMarker["*"] {
color: $textColor;
}
+QLabel, RiuQwtPlotLegend {
+ background-color: transparent;
+}
+
QwtPlot["PvtPlot"]::pointMarker["*"] {
color: $textColor;
}
diff --git a/ApplicationExeCode/Resources/undo-stack.svg b/ApplicationExeCode/Resources/undo-stack.svg
new file mode 100644
index 0000000000..eabdd7e0c5
--- /dev/null
+++ b/ApplicationExeCode/Resources/undo-stack.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/view-snapshots.svg b/ApplicationExeCode/Resources/view-snapshots.svg
new file mode 100644
index 0000000000..c5343b4117
--- /dev/null
+++ b/ApplicationExeCode/Resources/view-snapshots.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/view.svg b/ApplicationExeCode/Resources/view.svg
new file mode 100644
index 0000000000..390221b8da
--- /dev/null
+++ b/ApplicationExeCode/Resources/view.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/Resources/well-log-plot.svg b/ApplicationExeCode/Resources/well-log-plot.svg
new file mode 100644
index 0000000000..9df12a42ec
--- /dev/null
+++ b/ApplicationExeCode/Resources/well-log-plot.svg
@@ -0,0 +1,12 @@
+
+
+
diff --git a/ApplicationExeCode/Resources/window-management.svg b/ApplicationExeCode/Resources/window-management.svg
new file mode 100644
index 0000000000..829ba31e38
--- /dev/null
+++ b/ApplicationExeCode/Resources/window-management.svg
@@ -0,0 +1,3 @@
+
diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp
index 7e158905aa..67fb3b5232 100644
--- a/ApplicationExeCode/RiaMain.cpp
+++ b/ApplicationExeCode/RiaMain.cpp
@@ -18,6 +18,7 @@
#include "RiaArgumentParser.h"
#include "RiaLogging.h"
+#include "RiaMainTools.h"
#ifdef ENABLE_GRPC
#include "RiaGrpcConsoleApplication.h"
@@ -26,6 +27,7 @@
#include "RiaConsoleApplication.h"
#include "RiaGuiApplication.h"
#endif
+
#include "cvfProgramOptions.h"
#include "cvfqtUtils.h"
@@ -66,8 +68,12 @@ int main( int argc, char* argv[] )
return 1;
}
#endif
+ // Global initialization
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
+ // Create feature manager before the application object is created
+ RiaMainTools::initializeSingletons();
+
std::unique_ptr app( createApplication( argc, argv ) );
cvf::ProgramOptions progOpt;
@@ -112,6 +118,9 @@ int main( int argc, char* argv[] )
// Make sure project is closed to avoid assert and crash in destruction of widgets
app->closeProject();
+ app.reset();
+ RiaMainTools::releaseSingletonAndFactoryObjects();
+
return 0;
}
else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR )
@@ -147,6 +156,9 @@ int main( int argc, char* argv[] )
throw;
}
+ app.reset();
+ RiaMainTools::releaseSingletonAndFactoryObjects();
+
return exitCode;
}
diff --git a/ApplicationExeCode/RiaMainTools.cpp b/ApplicationExeCode/RiaMainTools.cpp
new file mode 100644
index 0000000000..4a2fdcded3
--- /dev/null
+++ b/ApplicationExeCode/RiaMainTools.cpp
@@ -0,0 +1,61 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022 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 "RiaMainTools.h"
+#include "RiaRegressionTestRunner.h"
+#include "RiaSocketCommand.h"
+
+#include "cafCmdFeature.h"
+#include "cafCmdFeatureManager.h"
+#include "cafPdmDefaultObjectFactory.h"
+#include "cafPdmUiFieldEditorHandle.h"
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaMainTools::initializeSingletons()
+{
+ caf::CmdFeatureManager::createSingleton();
+ RiaRegressionTestRunner::createSingleton();
+ caf::PdmDefaultObjectFactory::createSingleton();
+}
+
+//--------------------------------------------------------------------------------------------------
+/// This method is used to release memory allocated by static functions. This enables use of memory allocation tools
+/// after the application has closed down.
+//--------------------------------------------------------------------------------------------------
+void RiaMainTools::releaseSingletonAndFactoryObjects()
+{
+ caf::CmdFeatureManager::deleteSingleton();
+ RiaRegressionTestRunner::deleteSingleton();
+ caf::PdmDefaultObjectFactory::deleteSingleton();
+
+ {
+ auto factory = caf::Factory::instance();
+ factory->deleteCreatorObjects();
+ }
+
+ {
+ auto factory = caf::Factory::instance();
+ factory->deleteCreatorObjects();
+ }
+ {
+ auto factory = caf::Factory::instance();
+ factory->deleteCreatorObjects();
+ }
+}
diff --git a/ApplicationExeCode/RiaMainTools.h b/ApplicationExeCode/RiaMainTools.h
new file mode 100644
index 0000000000..025e9bc256
--- /dev/null
+++ b/ApplicationExeCode/RiaMainTools.h
@@ -0,0 +1,25 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022 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
+
+class RiaMainTools
+{
+public:
+ static void initializeSingletons();
+ static void releaseSingletonAndFactoryObjects();
+};
diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake
index 57990caa03..6a3a6e2c22 100644
--- a/ApplicationLibCode/Application/CMakeLists_files.cmake
+++ b/ApplicationLibCode/Application/CMakeLists_files.cmake
@@ -21,9 +21,14 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.h
${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.h
+ ${CMAKE_CURRENT_LIST_DIR}/RiaPlotDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.h
${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.h
+ ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.h
+ ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.h
+ ${CMAKE_CURRENT_LIST_DIR}/RiaPlotCollectionScheduler.h
+ ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -49,9 +54,14 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/RiaPlotDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/RiaPlotCollectionScheduler.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
@@ -63,8 +73,8 @@ set(QT_MOC_HEADERS
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
- ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.h
+ ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h
)
source_group(
diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp
index 4063921982..221f6b0da7 100644
--- a/ApplicationLibCode/Application/RiaApplication.cpp
+++ b/ApplicationLibCode/Application/RiaApplication.cpp
@@ -31,6 +31,7 @@
#include "RiaTextStringTools.h"
#include "RiaVersionInfo.h"
#include "RiaViewRedrawScheduler.h"
+#include "RiaWellNameComparer.h"
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
#include "HoloLensCommands/RicHoloLensSessionManager.h"
@@ -39,6 +40,7 @@
#include "RicfCommandObject.h"
#include "CommandRouter/RimCommandRouter.h"
+#include "PlotTemplates/RimPlotTemplateFolderItem.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
@@ -55,6 +57,7 @@
#include "RimGeoMechCellColors.h"
#include "RimGeoMechModels.h"
#include "RimGeoMechView.h"
+#include "RimGridCalculationCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimObservedDataCollection.h"
@@ -63,6 +66,7 @@
#include "RimOilField.h"
#include "RimPlotWindow.h"
#include "RimProject.h"
+#include "RimScriptCollection.h"
#include "RimSimWellInViewCollection.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanModel.h"
@@ -94,6 +98,7 @@
#include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h"
#include "cafProgressInfo.h"
+#include "cafSelectionManager.h"
#include "cafUiProcess.h"
#include "cafUtils.h"
@@ -161,6 +166,8 @@ RiaApplication::RiaApplication()
RiaApplication::~RiaApplication()
{
RiaFontCache::clear();
+
+ caf::SelectionManager::instance()->setPdmRootObject( nullptr );
}
//--------------------------------------------------------------------------------------------------
@@ -701,6 +708,14 @@ bool RiaApplication::loadProject( const QString& projectFileName,
// Execute command objects, and release the mutex when the queue is empty
executeCommandObjects();
+ // Recalculate the results from grid property calculations.
+ // Has to be done late since the results are filtered by view cell visibility
+ for ( auto gridCalculation : m_project->gridCalculationCollection()->calculations() )
+ {
+ gridCalculation->calculate();
+ gridCalculation->updateDependentObjects();
+ }
+
RiaLogging::info( QString( "Completed open of project file : '%1'" ).arg( projectFileName ) );
return true;
@@ -782,6 +797,8 @@ void RiaApplication::closeProject()
m_project->close();
m_commandQueue.clear();
+ RiaWellNameComparer::clearCache();
+
onProjectClosed();
caf::PdmUiModelChangeDetector::instance()->reset();
@@ -1209,9 +1226,11 @@ void RiaApplication::applyPreferences()
if ( this->project() )
{
- this->project()->setScriptDirectories( m_preferences->scriptDirectories() );
+ this->project()->setScriptDirectories( m_preferences->scriptDirectories(), m_preferences->maxScriptFoldersDepth() );
this->project()->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
- this->project()->updateConnectedEditors();
+
+ project()->scriptCollection()->updateConnectedEditors();
+ project()->rootPlotTemplateItem()->updateConnectedEditors();
}
caf::ProgressInfoStatic::setEnabled( RiaPreferencesSystem::current()->showProgressBar() );
@@ -1494,8 +1513,10 @@ void RiaApplication::initialize()
// Start with a project
m_project = std::make_unique();
- m_project->setScriptDirectories( m_preferences->scriptDirectories() );
+ m_project->setScriptDirectories( m_preferences->scriptDirectories(), m_preferences->maxScriptFoldersDepth() );
m_project->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
+
+ caf::SelectionManager::instance()->setPdmRootObject( project() );
}
//--------------------------------------------------------------------------------------------------
@@ -1525,7 +1546,9 @@ void RiaApplication::resetProject()
m_project.reset();
m_preferences.reset();
- initialize();
+ // Call RiaApplication::initialize() to recreate project and preferences. Do not call virtual method initialize(),
+ // as RiaGuiApplication::initialize() creates a new logger causing console text to disappear.
+ RiaApplication::initialize();
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp
index 3730f07273..c103de733d 100644
--- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp
+++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp
@@ -56,7 +56,7 @@ RiaCompletionTypeCalculationScheduler* RiaCompletionTypeCalculationScheduler::in
void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews()
{
std::vector eclipseCases =
- RimProject::current()->activeOilField()->analysisModels->cases().childObjects();
+ RimProject::current()->activeOilField()->analysisModels->cases().children();
scheduleRecalculateCompletionTypeAndRedrawAllViews( eclipseCases );
}
@@ -78,38 +78,50 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd
void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews(
const std::vector& eclipseCases )
{
+ clearCompletionTypeResults( eclipseCases );
+
for ( RimEclipseCase* eclipseCase : eclipseCases )
{
- CVF_ASSERT( eclipseCase );
-
- if ( eclipseCase->eclipseCaseData() )
- {
- eclipseCase->eclipseCaseData()
- ->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
- ->clearScalarResult( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
- RiaResultNames::completionTypeResultName() );
+ if ( eclipseCase ) m_eclipseCasesToRecalculate.emplace_back( eclipseCase );
+ }
- // Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type
- eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr );
- }
+ startTimer( 0 );
+}
- m_eclipseCasesToRecalculate.push_back( eclipseCase );
- }
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaCompletionTypeCalculationScheduler::clearCompletionTypeResultsInAllCases()
+{
+ std::vector eclipseCases =
+ RimProject::current()->activeOilField()->analysisModels->cases().children();
- startTimer();
+ clearCompletionTypeResults( eclipseCases );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
+void RiaCompletionTypeCalculationScheduler::clearCompletionTypeResults( const std::vector& eclipseCases )
{
- if ( caf::ProgressState::isActive() )
+ for ( RimEclipseCase* eclipseCase : eclipseCases )
{
- startTimer();
- return;
+ if ( !eclipseCase || !eclipseCase->eclipseCaseData() ) continue;
+
+ eclipseCase->eclipseCaseData()
+ ->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
+ ->clearScalarResult( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::completionTypeResultName() );
+
+ // Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type
+ eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr );
}
+}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaCompletionTypeCalculationScheduler::performScheduledUpdates()
+{
std::set uniqueCases( m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end() );
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
@@ -149,28 +161,11 @@ void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
//--------------------------------------------------------------------------------------------------
RiaCompletionTypeCalculationScheduler::~RiaCompletionTypeCalculationScheduler()
{
- delete m_recalculateCompletionTypeTimer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaCompletionTypeCalculationScheduler::RiaCompletionTypeCalculationScheduler()
- : m_recalculateCompletionTypeTimer( nullptr )
-{
-}
-
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-void RiaCompletionTypeCalculationScheduler::startTimer()
{
- if ( !m_recalculateCompletionTypeTimer )
- {
- m_recalculateCompletionTypeTimer = new QTimer( this );
- m_recalculateCompletionTypeTimer->setSingleShot( true );
- connect( m_recalculateCompletionTypeTimer, SIGNAL( timeout() ), this, SLOT( slotRecalculateCompletionType() ) );
- }
-
- m_recalculateCompletionTypeTimer->start( 1500 );
}
diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h
index 9ea5fb94c3..1f7ad10416 100644
--- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h
+++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h
@@ -18,29 +18,30 @@
#pragma once
-#include "cafPdmPointer.h"
+#include "RiaScheduler.h"
-#include
+#include "cafPdmPointer.h"
#include
-class QTimer;
class RimEclipseCase;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-class RiaCompletionTypeCalculationScheduler : public QObject
+class RiaCompletionTypeCalculationScheduler : public RiaScheduler
{
Q_OBJECT;
public:
static RiaCompletionTypeCalculationScheduler* instance();
void scheduleRecalculateCompletionTypeAndRedrawAllViews();
+ void clearCompletionTypeResultsInAllCases();
+
void scheduleRecalculateCompletionTypeAndRedrawAllViews( RimEclipseCase* eclipseCase );
+ void clearCompletionTypeResults( const std::vector& eclipseCases );
-private slots:
- void slotRecalculateCompletionType();
+ void performScheduledUpdates() override;
private:
RiaCompletionTypeCalculationScheduler();
@@ -51,9 +52,6 @@ private slots:
void scheduleRecalculateCompletionTypeAndRedrawAllViews( const std::vector& eclipseCases );
- void startTimer();
-
private:
std::vector> m_eclipseCasesToRecalculate;
- QTimer* m_recalculateCompletionTypeTimer;
};
diff --git a/ApplicationLibCode/Application/RiaDateTimeDefines.cpp b/ApplicationLibCode/Application/RiaDateTimeDefines.cpp
new file mode 100644
index 0000000000..bbac4778a0
--- /dev/null
+++ b/ApplicationLibCode/Application/RiaDateTimeDefines.cpp
@@ -0,0 +1,60 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022- 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 "RiaDateTimeDefines.h"
+
+#include "cafAppEnum.h"
+
+namespace caf
+{
+template <>
+void caf::AppEnum::setUp()
+{
+ addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_NONE, "NO_DATE", "No Date" );
+ addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR, "YEAR", "Year Only" );
+ addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH, "YEAR_MONTH", "Year and Month" );
+ addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, "YEAR_MONTH_DAY", "Year, Month and Day" );
+ setDefault( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY );
+}
+
+template <>
+void caf::AppEnum::setUp()
+{
+ addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" );
+ addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR, "HOUR", "Hour Only" );
+ addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" );
+ addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND,
+ "HOUR_MINUTE_SECONDS",
+ "Hour, Minutes and Seconds" );
+ setDefault( RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE );
+}
+
+template <>
+void caf::AppEnum::setUp()
+{
+ addItem( RiaDefines::DateTimePeriod::NONE, "NONE", "None" );
+ addItem( RiaDefines::DateTimePeriod::DAY, "DAY", "Day" );
+ addItem( RiaDefines::DateTimePeriod::WEEK, "WEEK", "Week" );
+ addItem( RiaDefines::DateTimePeriod::MONTH, "MONTH", "Month" );
+ addItem( RiaDefines::DateTimePeriod::QUARTER, "QUARTER", "Quarter" );
+ addItem( RiaDefines::DateTimePeriod::HALFYEAR, "HALFYEAR", "Half Year" );
+ addItem( RiaDefines::DateTimePeriod::YEAR, "YEAR", "Year" );
+ addItem( RiaDefines::DateTimePeriod::DECADE, "DECADE", "Decade" );
+ setDefault( RiaDefines::DateTimePeriod::NONE );
+}
+} // namespace caf
diff --git a/ApplicationLibCode/Application/RiaDateTimeDefines.h b/ApplicationLibCode/Application/RiaDateTimeDefines.h
new file mode 100644
index 0000000000..dcd235464d
--- /dev/null
+++ b/ApplicationLibCode/Application/RiaDateTimeDefines.h
@@ -0,0 +1,59 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022- 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 "cafAppEnum.h"
+
+namespace RiaDefines
+{
+enum class DateFormatComponents
+{
+ DATE_FORMAT_UNSPECIFIED = -2,
+ DATE_FORMAT_NONE = -1,
+ DATE_FORMAT_YEAR = 0,
+ DATE_FORMAT_YEAR_MONTH,
+ DATE_FORMAT_YEAR_MONTH_DAY,
+};
+
+enum class TimeFormatComponents
+{
+ TIME_FORMAT_UNSPECIFIED = -2,
+ TIME_FORMAT_NONE = -1,
+ TIME_FORMAT_HOUR,
+ TIME_FORMAT_HOUR_MINUTE,
+ TIME_FORMAT_HOUR_MINUTE_SECOND,
+ TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND,
+ TIME_FORMAT_SIZE
+};
+
+enum class DateTimePeriod
+{
+ NONE = -1,
+ DAY,
+ WEEK,
+ MONTH,
+ QUARTER,
+ HALFYEAR,
+ YEAR,
+ DECADE
+};
+
+using DateTimePeriodEnum = caf::AppEnum;
+
+}; // namespace RiaDefines
diff --git a/ApplicationLibCode/Application/RiaDefines.cpp b/ApplicationLibCode/Application/RiaDefines.cpp
index 9df23af602..d9bb911053 100644
--- a/ApplicationLibCode/Application/RiaDefines.cpp
+++ b/ApplicationLibCode/Application/RiaDefines.cpp
@@ -72,15 +72,6 @@ void caf::AppEnum::setUp()
setDefault( RiaDefines::DepthTypeEnum::MEASURED_DEPTH );
}
-template <>
-void caf::AppEnum::setUp()
-{
- addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" );
- addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" );
-
- setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
-}
-
template <>
void caf::AppEnum::setUp()
{
@@ -146,6 +137,26 @@ void AppEnum::setUp()
setDefault( RiaDefines::RINavigationPolicy::NAVIGATION_POLICY_RMS );
}
+template <>
+void caf::AppEnum::setUp()
+{
+ addItem( RiaDefines::ColumnCount::COLUMNS_1, "1", "1 Column" );
+ addItem( RiaDefines::ColumnCount::COLUMNS_2, "2", "2 Columns" );
+ addItem( RiaDefines::ColumnCount::COLUMNS_3, "3", "3 Columns" );
+ addItem( RiaDefines::ColumnCount::COLUMNS_4, "4", "4 Columns" );
+ setDefault( RiaDefines::ColumnCount::COLUMNS_2 );
+}
+
+template <>
+void caf::AppEnum::setUp()
+{
+ addItem( RiaDefines::RowCount::ROWS_1, "1", "1 Row" );
+ addItem( RiaDefines::RowCount::ROWS_2, "2", "2 Rows" );
+ addItem( RiaDefines::RowCount::ROWS_3, "3", "3 Rows" );
+ addItem( RiaDefines::RowCount::ROWS_4, "4", "4 Rows" );
+ setDefault( RiaDefines::RowCount::ROWS_2 );
+}
+
} // namespace caf
//--------------------------------------------------------------------------------------------------
@@ -243,30 +254,6 @@ RiaDefines::EclipseUnitSystem RiaDefines::fromDepthUnit( DepthUnitType depthUnit
return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
}
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-double RiaDefines::minimumDefaultValuePlot()
-{
- return -10.0;
-}
-
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-double RiaDefines::minimumDefaultLogValuePlot()
-{
- return 1.0;
-}
-
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-double RiaDefines::maximumDefaultValuePlot()
-{
- return 100.0;
-}
-
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -350,3 +337,11 @@ bool RiaDefines::isInjector( WellProductionType wellProductionType )
return false;
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+QString RiaDefines::stringListSeparator()
+{
+ return "|";
+}
diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h
index 77407d96fa..e52b34965a 100644
--- a/ApplicationLibCode/Application/RiaDefines.h
+++ b/ApplicationLibCode/Application/RiaDefines.h
@@ -107,18 +107,6 @@ enum class DepthTypeEnum
TRUE_VERTICAL_DEPTH_RKB
};
-// Defines relate to plotting
-enum class PlotAxis
-{
- PLOT_AXIS_LEFT,
- PLOT_AXIS_RIGHT,
- PLOT_AXIS_BOTTOM
-};
-
-double minimumDefaultValuePlot();
-double minimumDefaultLogValuePlot();
-double maximumDefaultValuePlot();
-
enum class PhaseType
{
OIL_PHASE,
@@ -197,4 +185,44 @@ enum class WellProductionType : short
bool isInjector( WellProductionType wellProductionType );
+QString stringListSeparator();
+
+enum class ColumnCount
+{
+ COLUMNS_1 = 1,
+ COLUMNS_2 = 2,
+ COLUMNS_3 = 3,
+ COLUMNS_4 = 4,
+ COLUMNS_UNLIMITED = 1000,
+};
+
+enum class RowCount
+{
+ ROWS_1 = 1,
+ ROWS_2 = 2,
+ ROWS_3 = 3,
+ ROWS_4 = 4,
+};
+
+enum class MultiPlotPageUpdateType : uint32_t
+{
+ NONE = 0b00000000,
+ LEGEND = 0b00000001,
+ PLOT = 0b00000010,
+ TITLE = 0b00000100,
+ ALL = 0b00000111
+};
+
+constexpr enum MultiPlotPageUpdateType operator|( const enum MultiPlotPageUpdateType selfValue,
+ const enum MultiPlotPageUpdateType inValue )
+{
+ return ( enum MultiPlotPageUpdateType )( uint32_t( selfValue ) | uint32_t( inValue ) );
+}
+
+constexpr enum MultiPlotPageUpdateType operator&( const enum MultiPlotPageUpdateType selfValue,
+ const enum MultiPlotPageUpdateType inValue )
+{
+ return ( enum MultiPlotPageUpdateType )( uint32_t( selfValue ) & uint32_t( inValue ) );
+}
+
}; // namespace RiaDefines
diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp
index 449a2578d3..c492c4d4d3 100644
--- a/ApplicationLibCode/Application/RiaGuiApplication.cpp
+++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp
@@ -22,6 +22,7 @@
#include "RiaArgumentParser.h"
#include "RiaBaseDefs.h"
+#include "RiaDefines.h"
#include "RiaFilePathTools.h"
#include "RiaFontCache.h"
#include "RiaImportEclipseCaseTools.h"
@@ -78,7 +79,6 @@
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryCrossPlotCollection.h"
#include "RimSummaryPlot.h"
-#include "RimSummaryPlotCollection.h"
#include "RimTextAnnotation.h"
#include "RimTextAnnotationInView.h"
#include "RimViewLinker.h"
@@ -100,6 +100,7 @@
#include "RiuMdiMaximizeWindowGuard.h"
#include "RiuMessagePanel.h"
#include "RiuPlotMainWindow.h"
+#include "RiuPlotMainWindowTools.h"
#include "RiuProcessMonitor.h"
#include "RiuRecentFileActionProvider.h"
#include "RiuViewer.h"
@@ -124,6 +125,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -188,8 +190,7 @@ RiaGuiApplication::RiaGuiApplication( int& argc, char** argv )
//--------------------------------------------------------------------------------------------------
RiaGuiApplication::~RiaGuiApplication()
{
- deleteMainPlotWindow();
- deleteMainWindow();
+ m_mainWindow.clear();
}
//--------------------------------------------------------------------------------------------------
@@ -294,39 +295,46 @@ bool RiaGuiApplication::saveProjectAs( const QString& fileName )
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::storeTreeViewState()
{
+ if ( m_mainWindow )
{
- if ( mainPlotWindow() && mainPlotWindow()->projectTreeView() )
- {
- caf::PdmUiTreeView* projectTreeView = mainPlotWindow()->projectTreeView();
+ QStringList treeStates;
+ QStringList treeIndexes;
+ for ( auto& tv : m_mainWindow->projectTreeViews() )
+ {
QString treeViewState;
- caf::QTreeViewStateSerializer::storeTreeViewStateToString( projectTreeView->treeView(), treeViewState );
+ tv->storeTreeViewStateToString( treeViewState );
+ treeStates.append( treeViewState );
- QModelIndex mi = projectTreeView->treeView()->currentIndex();
-
- QString encodedModelIndexString;
+ QModelIndex mi = tv->treeView()->currentIndex();
+ QString encodedModelIndexString;
caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString );
-
- project()->plotWindowTreeViewState = treeViewState;
- project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
+ treeIndexes.append( encodedModelIndexString );
}
+
+ project()->mainWindowTreeViewStates = treeStates.join( RiaDefines::stringListSeparator() );
+ project()->mainWindowCurrentModelIndexPaths = treeIndexes.join( RiaDefines::stringListSeparator() );
}
+ if ( m_mainPlotWindow )
{
- caf::PdmUiTreeView* projectTreeView = m_mainWindow->projectTreeView();
- if ( projectTreeView )
+ QStringList treeStates;
+ QStringList treeIndexes;
+
+ for ( auto& tv : mainPlotWindow()->projectTreeViews() )
{
QString treeViewState;
- caf::QTreeViewStateSerializer::storeTreeViewStateToString( projectTreeView->treeView(), treeViewState );
-
- QModelIndex mi = projectTreeView->treeView()->currentIndex();
+ tv->storeTreeViewStateToString( treeViewState );
+ treeStates.append( treeViewState );
- QString encodedModelIndexString;
+ QModelIndex mi = tv->treeView()->currentIndex();
+ QString encodedModelIndexString;
caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString );
-
- project()->mainWindowTreeViewState = treeViewState;
- project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
+ treeIndexes.append( encodedModelIndexString );
}
+
+ project()->plotWindowTreeViewStates = treeStates.join( RiaDefines::stringListSeparator() );
+ project()->plotWindowCurrentModelIndexPaths = treeIndexes.join( RiaDefines::stringListSeparator() );
}
}
@@ -562,6 +570,12 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( cvfqt::Utils::toQStringList( o.values() ) );
}
+ if ( cvf::Option o = progOpt->option( "openplotwindow" ) )
+ {
+ if ( m_mainWindow ) m_mainWindow->hide();
+ getOrCreateAndShowMainPlotWindow();
+ }
+
QString projectFileName;
if ( progOpt->hasOption( "last" ) )
@@ -775,7 +789,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
mainPlotWnd->loadWinGeoAndDockToolBarLayout();
}
- RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout();
+ if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout();
return ApplicationStatus::EXIT_COMPLETED;
}
@@ -909,6 +923,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow()
else
{
m_mainWindow->loadWinGeoAndDockToolBarLayout();
+ m_mainWindow->show();
}
return m_mainWindow;
@@ -933,7 +948,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateMainPlotWindow()
m_mainPlotWindow->initializeGuiNewProjectLoaded();
loadAndUpdatePlotData();
}
- return m_mainPlotWindow;
+ return m_mainPlotWindow.get();
}
//--------------------------------------------------------------------------------------------------
@@ -958,18 +973,6 @@ void RiaGuiApplication::createMainWindow()
m_mainWindow->showWindow();
}
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-void RiaGuiApplication::deleteMainWindow()
-{
- if ( m_mainWindow )
- {
- delete m_mainWindow;
- m_mainWindow = nullptr;
- }
-}
-
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -982,26 +985,13 @@ void RiaGuiApplication::createMainPlotWindow()
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
}
- m_mainPlotWindow = new RiuPlotMainWindow;
+ m_mainPlotWindow = std::make_unique();
m_mainPlotWindow->setWindowTitle( "Plots - ResInsight" );
m_mainPlotWindow->setDefaultWindowSize();
m_mainPlotWindow->loadWinGeoAndDockToolBarLayout();
m_mainPlotWindow->hideAllDockWidgets();
}
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-void RiaGuiApplication::deleteMainPlotWindow()
-{
- if ( m_mainPlotWindow )
- {
- m_mainPlotWindow->setParent( nullptr );
- delete m_mainPlotWindow;
- m_mainPlotWindow = nullptr;
- }
-}
-
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1038,7 +1028,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateAndShowMainPlotWindow()
m_mainPlotWindow->restoreDockWidgetVisibilities();
}
- return m_mainPlotWindow;
+ return m_mainPlotWindow.get();
}
//--------------------------------------------------------------------------------------------------
@@ -1046,7 +1036,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateAndShowMainPlotWindow()
//--------------------------------------------------------------------------------------------------
RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow()
{
- return m_mainPlotWindow;
+ return m_mainPlotWindow.get();
}
//--------------------------------------------------------------------------------------------------
@@ -1057,7 +1047,7 @@ RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID )
if ( mainWindowID == 0 )
return m_mainWindow;
else if ( mainWindowID == 1 )
- return m_mainPlotWindow;
+ return m_mainPlotWindow.get();
else
return nullptr;
}
@@ -1152,7 +1142,7 @@ void RiaGuiApplication::clearAllSelections()
void RiaGuiApplication::showFormattedTextInMessageBoxOrConsole( const QString& text )
{
// Create a message dialog with cut/paste friendly text
- QDialog dlg( RiuMainWindow::instance() );
+ QDialog dlg;
dlg.setModal( true );
QGridLayout* layout = new QGridLayout;
@@ -1235,7 +1225,7 @@ void RiaGuiApplication::onProjectBeingOpened()
void RiaGuiApplication::onProjectOpeningError( const QString& errMsg )
{
RiaLogging::errorInMessageBox( nullptr, "Error when opening project file", errMsg );
- m_mainWindow->setPdmRoot( nullptr );
+ if ( m_mainWindow ) m_mainWindow->setPdmRoot( nullptr );
}
//--------------------------------------------------------------------------------------------------
@@ -1245,11 +1235,11 @@ void RiaGuiApplication::onProjectOpened()
{
if ( m_project->show3DWindow() )
{
- m_mainWindow->show();
+ getOrCreateAndShowMainWindow();
}
else
{
- m_mainWindow->hide();
+ if ( m_mainWindow ) m_mainWindow->hide();
}
if ( m_project->showPlotWindow() )
@@ -1288,6 +1278,9 @@ void RiaGuiApplication::onProjectOpened()
m_maximizeWindowGuard.reset();
processEvents();
+
+ // Make sure to process events before this function to avoid strange Qt crash
+ RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
@@ -1303,12 +1296,8 @@ void RiaGuiApplication::onProjectBeingClosed()
RiaGuiApplication::clearAllSelections();
- m_mainWindow->cleanupGuiBeforeProjectClose();
-
- if ( m_mainPlotWindow )
- {
- m_mainPlotWindow->cleanupGuiBeforeProjectClose();
- }
+ if ( m_mainWindow ) m_mainWindow->cleanupGuiBeforeProjectClose();
+ if ( m_mainPlotWindow ) m_mainPlotWindow->cleanupGuiBeforeProjectClose();
caf::EffectGenerator::clearEffectCache();
}
@@ -1318,14 +1307,8 @@ void RiaGuiApplication::onProjectBeingClosed()
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::onProjectClosed()
{
- if ( m_mainWindow )
- {
- m_mainWindow->initializeGuiNewProjectLoaded();
- }
- if ( m_mainPlotWindow )
- {
- m_mainPlotWindow->initializeGuiNewProjectLoaded();
- }
+ if ( m_mainWindow ) m_mainWindow->initializeGuiNewProjectLoaded();
+ if ( m_mainPlotWindow ) m_mainPlotWindow->initializeGuiNewProjectLoaded();
setWindowCaptionFromAppState();
@@ -1374,13 +1357,19 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
caf::EffectGenerator::setRenderingMode( caf::EffectGenerator::FIXED_FUNCTION );
}
- if ( m_mainWindow && m_mainWindow->projectTreeView() )
+ if ( m_mainWindow )
{
- m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText(
- RiaPreferencesSystem::current()->appendClassNameToUiText() );
- if ( mainPlotWindow() )
- mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(
- RiaPreferencesSystem::current()->appendClassNameToUiText() );
+ for ( auto& tv : m_mainWindow->projectTreeViews() )
+ {
+ tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
+ }
+ }
+ if ( mainPlotWindow() )
+ {
+ for ( auto& tv : mainPlotWindow()->projectTreeViews() )
+ {
+ tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
+ }
}
for ( auto fontObject : defaultFontObjects )
@@ -1494,7 +1483,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
rim3dView->updateScaling();
if ( rim3dView == activeViewWindow() )
{
- RiuMainWindow::instance()->updateScaleValue();
+ if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->updateScaleValue();
}
}
@@ -1567,6 +1556,7 @@ int RiaGuiApplication::applicationResolution()
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess )
{
+ CAF_ASSERT( m_mainWindow );
m_mainWindow->processMonitor()->startMonitorWorkProcess( uiProcess );
}
@@ -1575,6 +1565,7 @@ void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess )
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::stopMonitoringWorkProgress()
{
+ CAF_ASSERT( m_mainWindow );
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
}
@@ -1583,6 +1574,8 @@ void RiaGuiApplication::stopMonitoringWorkProgress()
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitStatus exitStatus )
{
+ CAF_ASSERT( m_mainWindow );
+
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
QProcessEnvironment processEnvironment = m_workerProcess->processEnvironment();
@@ -1688,13 +1681,35 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event )
"unstable and will probably crash soon." );
}
- bool done = true;
+ bool done = false;
try
{
- done = QApplication::notify( receiver, event );
+ if ( event->type() == QEvent::KeyPress )
+ {
+ if ( activeWindow() != mainWindow() )
+ {
+ QKeyEvent* keyEvent = static_cast( event );
+ RimPlotWindow* plot = dynamic_cast( activePlotWindow() );
+ if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent );
+ }
+ }
+ else if ( event->type() == QEvent::Wheel )
+ {
+ if ( activeWindow() != mainWindow() )
+ {
+ QWheelEvent* wheelEvent = static_cast( event );
+ RimPlotWindow* plot = dynamic_cast( activePlotWindow() );
+ if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent );
+ }
+ }
+ if ( !done )
+ {
+ done = QApplication::notify( receiver, event );
+ }
}
catch ( const std::bad_alloc& )
{
+ done = true;
if ( memoryExhaustedBox ) memoryExhaustedBox->exec();
std::cout << "ResInsight: Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now "
"unstable "
diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h
index e4fd72590f..8e2fbcb10f 100644
--- a/ApplicationLibCode/Application/RiaGuiApplication.h
+++ b/ApplicationLibCode/Application/RiaGuiApplication.h
@@ -134,6 +134,8 @@ class RiaGuiApplication : public QApplication, public RiaApplication
void showFormattedTextInMessageBoxOrConsole( const QString& errMsg ) override;
protected:
+ bool notify( QObject* receiver, QEvent* event ) override;
+
// Protected RiaApplication overrides
void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) override;
void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) override;
@@ -155,21 +157,17 @@ class RiaGuiApplication : public QApplication, public RiaApplication
void setWindowCaptionFromAppState();
void createMainWindow();
- void deleteMainWindow();
void createMainPlotWindow();
- void deleteMainPlotWindow();
void storeTreeViewState();
- bool notify( QObject*, QEvent* ) override;
-
private slots:
void slotWorkerProcessFinished( int exitCode, QProcess::ExitStatus exitStatus );
void onLastWindowClosed();
private:
- QPointer m_mainWindow;
- QPointer m_mainPlotWindow;
+ QPointer m_mainWindow;
+ std::unique_ptr m_mainPlotWindow;
std::unique_ptr m_recentFileActionProvider;
diff --git a/ApplicationLibCode/Application/RiaMemoryCleanup.cpp b/ApplicationLibCode/Application/RiaMemoryCleanup.cpp
index ae2b4f0af2..52fa4158b8 100644
--- a/ApplicationLibCode/Application/RiaMemoryCleanup.cpp
+++ b/ApplicationLibCode/Application/RiaMemoryCleanup.cpp
@@ -47,14 +47,14 @@ CAF_PDM_SOURCE_INIT( RiaMemoryCleanup, "RiaMemoryCleanup" );
RiaMemoryCleanup::RiaMemoryCleanup()
{
// clang-format off
- CAF_PDM_InitFieldNoDefault(&m_case, "DataCase", "Case", "", "", "");
+ CAF_PDM_InitFieldNoDefault(&m_case, "DataCase", "Case");
m_case = nullptr;
- CAF_PDM_InitFieldNoDefault(&m_resultsToDelete, "ResultsToDelete", "Results In Memory", "", "", "");
+ CAF_PDM_InitFieldNoDefault(&m_resultsToDelete, "ResultsToDelete", "Results In Memory");
m_resultsToDelete.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
m_resultsToDelete.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
- CAF_PDM_InitFieldNoDefault(&m_performDelete, "ClearSelectedData", "", "", "", "");
+ CAF_PDM_InitFieldNoDefault(&m_performDelete, "ClearSelectedData", "");
caf::PdmUiPushButtonEditor::configureEditorForField(&m_performDelete);
// clang-format on
}
@@ -215,8 +215,7 @@ void RiaMemoryCleanup::fieldChangedByUi( const caf::PdmFieldHandle* changedField
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-QList RiaMemoryCleanup::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
- bool* useOptionsOnly )
+QList RiaMemoryCleanup::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
QList options;
if ( fieldNeedingOptions == &m_case )
diff --git a/ApplicationLibCode/Application/RiaMemoryCleanup.h b/ApplicationLibCode/Application/RiaMemoryCleanup.h
index c15087e52c..99f9190944 100644
--- a/ApplicationLibCode/Application/RiaMemoryCleanup.h
+++ b/ApplicationLibCode/Application/RiaMemoryCleanup.h
@@ -48,8 +48,7 @@ class RiaMemoryCleanup : public caf::PdmObject
std::set findGeoMechCaseResultsInUse() const;
std::set findEclipseResultsInUse() const;
- QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
- bool* useOptionsOnly ) override;
+ QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
@@ -61,4 +60,4 @@ class RiaMemoryCleanup : public caf::PdmObject
std::vector m_geomResultAddresses;
std::vector m_eclipseResultAddresses;
caf::PdmField m_performDelete;
-};
\ No newline at end of file
+};
diff --git a/ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp
new file mode 100644
index 0000000000..25055c0893
--- /dev/null
+++ b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp
@@ -0,0 +1,73 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022- 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 "RiaPlotCollectionScheduler.h"
+
+#include "RimAbstractPlotCollection.h"
+#include "RimViewWindow.h"
+
+#include "cafProgressState.h"
+
+#include
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RiaPlotCollectionScheduler::RiaPlotCollectionScheduler()
+{
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RiaPlotCollectionScheduler::~RiaPlotCollectionScheduler()
+{
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RiaPlotCollectionScheduler* RiaPlotCollectionScheduler::instance()
+{
+ static RiaPlotCollectionScheduler theInstance;
+
+ return &theInstance;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaPlotCollectionScheduler::schedulePlotCollectionUpdate( const std::vector plotCollections )
+{
+ m_plotCollectionsToUpdate.insert( m_plotCollectionsToUpdate.end(), plotCollections.begin(), plotCollections.end() );
+
+ startTimer( 0 );
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaPlotCollectionScheduler::performScheduledUpdates()
+{
+ for ( auto p : m_plotCollectionsToUpdate )
+ {
+ if ( p == nullptr ) continue;
+
+ p->loadDataAndUpdateAllPlots();
+ }
+}
diff --git a/ApplicationLibCode/Application/RiaPlotCollectionScheduler.h b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.h
new file mode 100644
index 0000000000..aded19656a
--- /dev/null
+++ b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.h
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022- 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 "RiaScheduler.h"
+
+class RimPlotCollection;
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+class RiaPlotCollectionScheduler : public RiaScheduler
+{
+public:
+ RiaPlotCollectionScheduler();
+ ~RiaPlotCollectionScheduler() override;
+
+ static RiaPlotCollectionScheduler* instance();
+
+ void schedulePlotCollectionUpdate( const std::vector plotCollections );
+
+ void performScheduledUpdates() override;
+
+private:
+ std::vector m_plotCollectionsToUpdate;
+};
diff --git a/ApplicationLibCode/Application/RiaPlotDefines.cpp b/ApplicationLibCode/Application/RiaPlotDefines.cpp
new file mode 100644
index 0000000000..6ee4a9f171
--- /dev/null
+++ b/ApplicationLibCode/Application/RiaPlotDefines.cpp
@@ -0,0 +1,95 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022- 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 "RiaPlotDefines.h"
+
+#include "RiaGuiApplication.h"
+#include "RiaPreferencesSystem.h"
+
+#include "cafAppEnum.h"
+
+namespace caf
+{
+template <>
+void caf::AppEnum::setUp()
+{
+ addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" );
+ addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" );
+ addItem( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "PLOT_AXIS_BOTTOM", "Bottom" );
+ addItem( RiaDefines::PlotAxis::PLOT_AXIS_TOP, "PLOT_AXIS_TOP", "Top" );
+
+ setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
+}
+}; // namespace caf
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+double RiaDefines::minimumDefaultValuePlot()
+{
+ return -10.0;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+double RiaDefines::minimumDefaultLogValuePlot()
+{
+ return 1.0;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+double RiaDefines::maximumDefaultValuePlot()
+{
+ return 100.0;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RiaDefines::isHorizontal( RiaDefines::PlotAxis axis )
+{
+ return !isVertical( axis );
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RiaDefines::isVertical( RiaDefines::PlotAxis axis )
+{
+ return ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+double RiaDefines::scalingFactor( QPaintDevice* paintDevice )
+{
+ auto scalingFactor = RiaPreferencesSystem::current()->exportPdfScalingFactor();
+
+ if ( scalingFactor > 0.0 ) return scalingFactor;
+
+ if ( !paintDevice ) return 1.0;
+
+ int resolution = paintDevice->logicalDpiX();
+ double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() );
+
+ return scaling;
+}
diff --git a/ApplicationLibCode/Application/RiaPlotDefines.h b/ApplicationLibCode/Application/RiaPlotDefines.h
new file mode 100644
index 0000000000..1bbb56cae2
--- /dev/null
+++ b/ApplicationLibCode/Application/RiaPlotDefines.h
@@ -0,0 +1,43 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2022- 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
+
+class QPaintDevice;
+
+// Defines relate to plotting
+namespace RiaDefines
+{
+enum class PlotAxis
+{
+ PLOT_AXIS_LEFT,
+ PLOT_AXIS_RIGHT,
+ PLOT_AXIS_BOTTOM,
+ PLOT_AXIS_TOP
+};
+
+double minimumDefaultValuePlot();
+double minimumDefaultLogValuePlot();
+double maximumDefaultValuePlot();
+
+bool isHorizontal( PlotAxis axis );
+bool isVertical( PlotAxis axis );
+
+double scalingFactor( QPaintDevice* paintDevice );
+
+}; // namespace RiaDefines
diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp
index 0aafd16592..f0d1f65c2f 100644
--- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp
+++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp
@@ -19,7 +19,7 @@
#include "RiuMultiPlotBook.h"
#include "RiuMultiPlotPage.h"
-#include "RiuQwtPlotWidget.h"
+#include "RiuPlotWidget.h"
#include
#include
@@ -41,9 +41,17 @@ RiaPlotWindowRedrawScheduler* RiaPlotWindowRedrawScheduler::instance()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow )
+void RiaPlotWindowRedrawScheduler::scheduleMultiPlotBookUpdate( RiuMultiPlotBook* plotBook,
+ RiaDefines::MultiPlotPageUpdateType updateType )
{
- m_plotWindowsToUpdate.push_back( plotWindow );
+ if ( m_plotBooksToUpdate.count( plotBook ) == 0 )
+ {
+ m_plotBooksToUpdate[plotBook] = updateType;
+ }
+ else
+ {
+ m_plotBooksToUpdate[plotBook] = m_plotBooksToUpdate[plotBook] | updateType;
+ }
startTimer( 0 );
}
@@ -51,9 +59,17 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotPage )
+void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotPage,
+ RiaDefines::MultiPlotPageUpdateType updateType )
{
- m_plotPagesToUpdate.push_back( plotPage );
+ if ( m_plotPagesToUpdate.count( plotPage ) == 0 )
+ {
+ m_plotPagesToUpdate[plotPage] = updateType;
+ }
+ else
+ {
+ m_plotPagesToUpdate[plotPage] = m_plotPagesToUpdate[plotPage] | updateType;
+ }
startTimer( 0 );
}
@@ -61,9 +77,9 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget )
+void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plotWidget )
{
- m_plotWidgetsToReplot.push_back( plotWidget );
+ m_plotWidgetsToReplot.insert( plotWidget );
startTimer( 0 );
}
@@ -82,7 +98,7 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
}
m_plotWidgetsToReplot.clear();
m_plotPagesToUpdate.clear();
- m_plotWindowsToUpdate.clear();
+ m_plotBooksToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
@@ -90,49 +106,44 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
{
- std::vector> plotWindowsToUpdate;
- std::vector> plotPagesToUpdate;
- std::vector> plotWidgetsToReplot;
+ std::map, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate;
+ std::map, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate;
- plotWindowsToUpdate.swap( m_plotWindowsToUpdate );
- plotPagesToUpdate.swap( m_plotPagesToUpdate );
- plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
+ pagesToUpdate.swap( m_plotPagesToUpdate );
+ plotBooksToUpdate.swap( m_plotBooksToUpdate );
- std::set> updatedPlots;
- std::set> updatedPlotWindows;
- std::set> updatedPlotPages;
-
- for ( QPointer plotWindow : plotWindowsToUpdate )
+ for ( auto& [plotBook, updateType] : plotBooksToUpdate )
{
- if ( !plotWindow.isNull() && !updatedPlotWindows.count( plotWindow ) )
+ if ( plotBook.isNull() ) continue;
+
+ if ( ( updateType & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT )
{
- for ( RiuMultiPlotPage* page : plotWindow->pages() )
+ for ( RiuMultiPlotPage* page : plotBook->pages() )
{
- plotPagesToUpdate.erase( std::remove( plotPagesToUpdate.begin(), plotPagesToUpdate.end(), page ),
- plotPagesToUpdate.end() );
+ if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page );
}
-
- plotWindow->performUpdate();
- updatedPlotWindows.insert( plotWindow );
}
+ plotBook->performUpdate( updateType );
}
- for ( QPointer plotPage : plotPagesToUpdate )
+ for ( auto& [page, updateType] : pagesToUpdate )
{
- if ( !plotPage.isNull() && !updatedPlotPages.count( plotPage ) )
- {
- plotPage->performUpdate();
- updatedPlotPages.insert( plotPage );
- }
+ if ( page.isNull() ) continue;
+
+ page->performUpdate( updateType );
}
- // Perform update and replot. Make sure we handle legend update
- for ( QPointer plot : plotWidgetsToReplot )
+ // PERFORMANCE NOTE
+ // As the book and page updates can trigger widget updates, make sure to get the list of widgets to replot after
+ // these updates
+ std::set> plotWidgetsToReplot;
+ plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
+
+ for ( const QPointer& plot : plotWidgetsToReplot )
{
- if ( !plot.isNull() && !updatedPlots.count( plot ) )
+ if ( !plot.isNull() )
{
plot->replot();
- updatedPlots.insert( plot );
}
}
}
diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h
index 4f43b0664d..a3a196d39a 100644
--- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h
+++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h
@@ -19,16 +19,19 @@
#include "cafPdmPointer.h"
+#include "RiaDefines.h"
+
#include
#include
#include
#include
+#include