Release 2023.06

This commit is contained in:
Magne Sjaastad
2023-06-19 13:48:44 +02:00
committed by GitHub
parent a7108f0a09
commit 77bf792b1a
1390 changed files with 66974 additions and 11511 deletions

View File

@@ -353,9 +353,10 @@ void RiuGroupedBarChartBuilder::addBarEntry( const QString& majorTickText,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGroupedBarChartBuilder::setLegendColorMap( const std::map<QString, QColor>& legendColors )
void RiuGroupedBarChartBuilder::setBarColor( const QColor& color )
{
m_legendColors = legendColors;
m_useBarColor = true;
m_barColor = color;
}
//--------------------------------------------------------------------------------------------------
@@ -654,15 +655,11 @@ void RiuGroupedBarChartBuilder::addBarChartToPlot( QwtPlot* plot, Qt::Orientatio
int idx = 0;
for ( const auto& legendToBarPointsPair : legendToBarPointsMap )
{
QColor legendColor = RiaColorTables::categoryPaletteColors().cycledQColor( idx );
QColor color = RiaColorTables::categoryPaletteColors().cycledQColor( idx );
auto legendColorPairIt = m_legendColors.find( legendToBarPointsPair.first );
if ( legendColorPairIt != m_legendColors.end() )
{
legendColor = legendColorPairIt->second;
}
if ( m_useBarColor ) color = m_barColor;
addQwtBarChart( plot, legendToBarPointsPair.second, legendToBarPointsPair.first, legendColor, barOrientation );
addQwtBarChart( plot, legendToBarPointsPair.second, legendToBarPointsPair.first, color, barOrientation );
idx++;
}

View File

@@ -18,6 +18,7 @@
#pragma once
#include <QColor>
#include <QPointF>
#include <QString>
#include <QVector>
@@ -27,7 +28,6 @@
#include <set>
class QwtPlot;
class QColor;
//--------------------------------------------------------------------------------------------------
///
@@ -45,7 +45,7 @@ public:
const QString& barText,
const double value );
void setLegendColorMap( const std::map<QString, QColor>& legendColors );
void setBarColor( const QColor& color );
void addBarChartToPlot( QwtPlot* plot, Qt::Orientation orientation, int maxBarCount = -1 );
void setLabelFontSize( int labelPointSize );
@@ -85,9 +85,10 @@ private:
bool operator<( const BarEntry& other ) const;
};
std::multiset<BarEntry> m_sortedBarEntries;
Qt::Orientation m_orientation;
std::map<QString, QColor> m_legendColors;
bool m_isSortingByMaxValueInGroups;
int m_labelPointSize;
std::multiset<BarEntry> m_sortedBarEntries;
bool m_isSortingByMaxValueInGroups;
int m_labelPointSize;
bool m_useBarColor = false;
QColor m_barColor;
};

View File

@@ -99,12 +99,15 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RiuAbstractOverlayContentFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtLegendOverlayContentFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuAbstractLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuSeismicHistogramPanel.h
${CMAKE_CURRENT_LIST_DIR}/RiuCategoryLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuScalarMapperLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuFileDialogTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuGuiTheme.h
${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtDateScaleWrapper.h
${CMAKE_CURRENT_LIST_DIR}/RiuMatrixPlotWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuMenuBarBuildTools.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -206,11 +209,14 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiuScalarMapperLegendFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuFileDialogTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuGuiTheme.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuSeismicHistogramPanel.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuTextEditWithCompletion.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuTextContentFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtLegendOverlayContentFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtDateScaleWrapper.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuMatrixPlotWidget.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuMenuBarBuildTools.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)
@@ -257,6 +263,7 @@ list(
${CMAKE_CURRENT_LIST_DIR}/RiuMdiArea.h
${CMAKE_CURRENT_LIST_DIR}/RiuMdiSubWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuPvtPlotPanel.h
${CMAKE_CURRENT_LIST_DIR}/RiuSeismicHistogramPanel.h
${CMAKE_CURRENT_LIST_DIR}/RiuRelativePermeabilityPlotPanel.h
${CMAKE_CURRENT_LIST_DIR}/RiuResultInfoPanel.h
${CMAKE_CURRENT_LIST_DIR}/RiuResultQwtPlot.h
@@ -301,6 +308,7 @@ list(
${CMAKE_CURRENT_LIST_DIR}/RiuTextEditWithCompletion.h
${CMAKE_CURRENT_LIST_DIR}/RiuTextContentFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtLegendOverlayContentFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuMatrixPlotWidget.h
)
list(APPEND QT_UI_FILES)

View File

@@ -95,7 +95,7 @@ private:
~Riu3dSelectionManager();
Riu3dSelectionManager( const Riu3dSelectionManager& ) = delete;
void operator=( const Riu3dSelectionManager& o ) = delete;
void operator=( const Riu3dSelectionManager& o ) = delete;
void deleteAllItemsFromSelection( int role );

View File

@@ -147,8 +147,7 @@ void RiuAdvancedSnapshotExportWidget::addSnapshotItemFromActiveView()
multiSnapshot->timeStepStart = activeView->currentTimeStep();
multiSnapshot->timeStepEnd = activeView->currentTimeStep();
RimCase* sourceCase = nullptr;
activeView->firstAncestorOrThisOfType( sourceCase );
auto sourceCase = activeView->firstAncestorOrThisOfType<RimCase>();
if ( sourceCase )
{
multiSnapshot->additionalCases().push_back( sourceCase );

View File

@@ -266,7 +266,7 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve
if ( intersectionView )
{
intersectionView->intersection()->firstAncestorOrThisOfType( associatedGridView );
associatedGridView = intersectionView->intersection()->firstAncestorOrThisOfType<RimGridView>();
}
// Use the clicked views default settings if we have not found any special stuff
@@ -384,7 +384,7 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve
if ( intersectionHit )
selItem = new RiuGeoMechSelectionItem( associatedGridView,
geomResDef,
timestepIndex,
static_cast<int>( timestepIndex ),
dataFrameIndex,
gridIndex,
gridLocalCellIndex,
@@ -395,7 +395,7 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve
else
selItem = new RiuGeoMechSelectionItem( associatedGridView,
geomResDef,
timestepIndex,
static_cast<int>( timestepIndex ),
dataFrameIndex,
gridIndex,
gridLocalCellIndex,

View File

@@ -115,6 +115,14 @@ QString RiuDockWidgetTools::mainWindowPvtPlotName()
return "dockPvtPlot_mainWindow";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuDockWidgetTools::mainWindowSeismicHistogramName()
{
return "dockSeisHist_mainWindow";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -312,7 +320,7 @@ QIcon RiuDockWidgetTools::dockIcon( const QString dockWidgetName )
else if ( dockWidgetName == plotMainWindowDataSourceTreeName() )
return QIcon( ":/data-sources.svg" );
else if ( dockWidgetName == plotMainWindowTemplateTreeName() )
return QIcon( ":/SummaryTemplate16x16.png" );
return QIcon( ":/plot-template-standard.svg" );
else if ( dockWidgetName == plotMainWindowScriptsTreeName() )
return QIcon( ":/scripts.svg" );
else if ( dockWidgetName == plotMainWindowPropertyEditorName() )
@@ -353,6 +361,8 @@ QIcon RiuDockWidgetTools::dockIcon( const QString dockWidgetName )
return QIcon( ":/window-management.svg" );
else if ( dockWidgetName == main3DWindowName() )
return QIcon( ":/window-management.svg" );
else if ( dockWidgetName == mainWindowSeismicHistogramName() )
return QIcon( ":/graph.svg" );
return QIcon( ":/view.svg" );
}
@@ -390,33 +400,33 @@ QByteArray RiuDockWidgetTools::defaultEclipseDockState()
// start paste
static const char stateData[] =
{ '\x00', '\x00', '\x06', '\x13', '\x78', '\xda', '\x95', '\x54', '\x4d', '\x6f', '\xc2', '\x30', '\x0c', '\xbd', '\xef', '\x57',
'\x44', '\xbd', '\x33', '\xe8', '\x07', '\x82', '\x03', '\x1f', '\x42', '\x30', '\xa4', '\x1d', '\xd8', '\xd8', '\x0a', '\xe3',
'\x38', '\x65', '\xad', '\x07', '\xd9', '\xd2', '\x04', '\x39', '\x29', '\x1b', '\xd3', '\x7e', '\xfc', '\xd2', '\x16', '\x21',
'\x01', '\x29', '\x5d', '\x0f', '\x55', '\x13', '\xfb', '\x3d', '\xfb', '\xd9', '\x71', '\xd2', '\x1b', '\x7e', '\x27', '\x9c',
'\xec', '\x00', '\x15', '\x93', '\xa2', '\xef', '\xb8', '\xb7', '\x2d', '\x87', '\x80', '\x88', '\x64', '\xcc', '\xc4', '\xba',
'\xef', '\x2c', '\x17', '\xd3', '\x46', '\xd7', '\x19', '\x0e', '\x7a', '\x4f', '\x7a', '\x14', '\xef', '\xa8', '\x88', '\x20',
'\x9e', '\xc8', '\xe8', '\xd3', '\xf8', '\xc2', '\xbd', '\xd2', '\x90', '\x90', '\x97', '\x23', '\xd1', '\x21', '\x4b', '\x05',
'\x78', '\xdc', '\xfb', '\x0e', '\x19', '\x4b', '\xa1', '\x29', '\x13', '\xc6', '\x92', '\xbb', '\xc7', '\x20', '\x34', '\x52',
'\xbe', '\x62', '\xf1', '\x1a', '\x74', '\xdf', '\x89', '\x4d', '\x1c', '\x7f', '\xb2', '\x62', '\x22', '\x96', '\x5f', '\xaf',
'\x89', '\xc1', '\x15', '\x4b', '\x67', '\xd0', '\x3b', '\xf2', '\xc8', '\x94', '\x4b', '\xaa', '\x73', '\x21', '\x2d', '\x63',
'\x0f', '\xb7', '\x9c', '\x69', '\x6d', '\xcc', '\x8f', '\xc8', '\x4c', '\x2c', '\xe3', '\xc9', '\x12', '\xfd', '\x66', '\x89',
'\x52', '\x61', '\x22', '\x7a', '\xa5', '\x98', '\xc6', '\x09', '\x66', '\x84', '\x40', '\xc9', '\x82', '\xbe', '\xa9', '\x42',
'\x65', '\x8a', '\x08', '\xe2', '\x20', '\x68', '\x8e', '\xf2', '\x03', '\x22', '\xbd', '\x40', '\x80', '\x53', '\x4d', '\x85',
'\x6a', '\xf2', '\x40', '\x13', '\xb8', '\x8a', '\x24', '\x63', '\x2e', '\x15', '\xc4', '\x99', '\xe0', '\xa6', '\x85', '\x35',
'\xa1', '\x9a', '\x86', '\x32', '\xc5', '\x08', '\x6a', '\x12', '\xc3', '\x08', '\xd9', '\x56', '\xab', '\xeb', '\xac', '\x66',
'\x56', '\xd9', '\x49', '\x7d', '\xee', '\x65', '\x7d', '\x5b', '\x40', '\xbd', '\xbf', '\x8b', '\x99', '\x96', '\x58', '\x5d',
'\x62', '\x09', '\xd8', '\x9a', '\x36', '\x64', '\x3f', '\xa0', '\x06', '\x9d', '\xc0', '\x27', '\xed', '\x56', '\x87', '\xf4',
'\x9a', '\xc5', '\xde', '\xfc', '\x0f', '\x47', '\x52', '\xfb', '\x70', '\xce', '\xc5', '\xdb', '\xa6', '\xc5', '\x8c', '\x08',
'\x5d', '\xe7', '\x58', '\x4b', '\x01', '\x56', '\x82', '\x55', '\x7a', '\xc5', '\x64', '\xf9', '\xd7', '\x85', '\x3d', '\x83',
'\x4a', '\xb9', '\xbe', '\x17', '\xef', '\xb2', '\xa2', '\xa3', '\x76', '\x60', '\xd5', '\x21', '\xb6', '\xad', '\xe9', '\xe6',
'\x5c', '\xea', '\x7f', '\xa5', '\x3b', '\x07', '\x56', '\x8d', '\x28', '\x6c', '\xf5', '\xa6', '\x26', '\x67', '\x26', '\x37',
'\xa8', '\xc6', '\x0c', '\x23', '\x0e', '\xa5', '\x4c', '\xd7', '\xca', '\x7c', '\x06', '\x3e', '\x07', '\x4c', '\x6a', '\xe6',
'\x9b', '\xef', '\x2a', '\xaa', '\xba', '\x6c', '\xa2', '\x77', '\xd6', '\xc4', '\x19', '\x28', '\x45', '\xd7', '\xa0', '\x2a',
'\x5a', '\x68', '\x83', '\x55', '\x89', '\x43', '\x19', '\x19', '\xd6', '\x4c', '\x8a', '\x1a', '\xd7', '\xa6', '\xed', '\xb9',
'\xc4', '\x75', '\x5b', '\x2e', '\x09', '\xba', '\x25', '\x77', '\x27', '\xb7', '\x74', '\xbd', '\x36', '\x09', '\xcc', '\x57',
'\x8e', '\x08', '\x7c', '\x9f', '\x78', '\xae', '\x89', '\x66', '\x83', '\x34', '\x8f', '\x4f', '\xab', '\x59', '\x97', '\x3c',
'\xe9', '\x83', '\x9b', '\x3f', '\xff', '\x64', '\x15', '\xea' };
{ '\x00', '\x00', '\x06', '\x46', '\x78', '\xda', '\x95', '\x55', '\xcb', '\x4e', '\xc3', '\x30', '\x10', '\xbc', '\xf3', '\x15',
'\x56', '\xee', '\xd0', '\xe6', '\x01', '\xf4', '\x90', '\x16', '\xa1', '\x14', '\x04', '\x87', '\x42', '\x69', '\x5a', '\x7a',
'\x44', '\x26', '\x59', '\x8a', '\xc1', '\xb1', '\xab', '\xf5', '\xb6', '\x3c', '\xc4', '\xc7', '\xe3', '\x3e', '\x14', '\xa9',
'\xc5', '\x69', '\xc8', '\x21', '\x8a', '\xbd', '\x9e', '\xf1', '\xce', '\xac', '\xd7', '\x49', '\x7c', '\xf1', '\x59', '\x48',
'\xb6', '\x04', '\x34', '\x42', '\xab', '\xae', '\xe7', '\x9f', '\xb4', '\x3d', '\x06', '\x2a', '\xd3', '\xb9', '\x50', '\xb3',
'\xae', '\x37', '\x19', '\x5f', '\x1f', '\x77', '\xbc', '\x8b', '\x5e', '\xfc', '\x40', '\x97', '\xf9', '\x92', '\xab', '\x0c',
'\xf2', '\xbe', '\xce', '\xde', '\xed', '\x5a', '\xfa', '\x65', '\x08', '\x0a', '\xf6', '\x58', '\x12', '\x3d', '\x36', '\x31',
'\x80', '\xe5', '\x3c', '\xf4', '\x58', '\xa2', '\x15', '\x71', '\xa1', '\x6c', '\x64', '\xbd', '\x9c', '\x80', '\x22', '\xe4',
'\x72', '\x2a', '\xf2', '\x19', '\x50', '\xd7', '\xcb', '\xed', '\x3e', '\x61', '\x7f', '\x2a', '\x54', '\xae', '\x3f', '\x9e',
'\x0a', '\x8b', '\xdb', '\x0c', '\xbd', '\x5e', '\x5c', '\xf2', '\xd8', '\xb5', '\xd4', '\x9c', '\xd6', '\x42', '\xda', '\x36',
'\x9e', '\xce', '\xa5', '\x20', '\xb2', '\xe1', '\x7b', '\x14', '\x76', '\x2f', '\xbb', '\xb2', '\x4a', '\xf4', '\xb3', '\x4a',
'\xb4', '\x50', '\x76', '\xc7', '\xa0', '\x12', '\x73', '\xbc', '\x83', '\xb9', '\x44', '\xe0', '\x6c', '\xcc', '\x9f', '\xcd',
'\x46', '\xe5', '\x02', '\x11', '\xd4', '\x56', '\xd0', '\x10', '\xf5', '\x1b', '\x64', '\x34', '\x46', '\x80', '\x5d', '\x4d',
'\x1b', '\xd5', '\xec', '\x8e', '\x17', '\x70', '\x10', '\xc9', '\x12', '\xa9', '\x0d', '\xe4', '\x2b', '\xc1', '\x2d', '\x07',
'\xab', '\xcf', '\x89', '\xa7', '\x7a', '\x81', '\x19', '\x34', '\x24', '\xa6', '\x19', '\x8a', '\x39', '\x99', '\xc3', '\xac',
'\xd6', '\xca', '\xd9', '\x8e', '\x3f', '\xff', '\xaf', '\xbf', '\x39', '\x20', '\x7d', '\x5d', '\xe5', '\x82', '\x34', '\xd6',
'\x5b', '\xac', '\x00', '\x3b', '\xd3', '\xa6', '\xe2', '\x1b', '\x4c', '\xef', '\x3c', '\x0a', '\xd9', '\x69', '\xfb', '\x9c',
'\xc5', '\xad', '\xcd', '\xdc', '\xbe', '\xb7', '\x47', '\xd2', '\xf8', '\x70', '\xf6', '\xc5', '\xbb', '\xba', '\xc5', '\xb6',
'\x08', '\x9f', '\xad', '\xb1', '\x0e', '\x03', '\x4e', '\x82', '\x53', '\x7a', '\x4d', '\x67', '\x85', '\x87', '\x85', '\x8d',
'\xc0', '\x2c', '\x24', '\xdd', '\xaa', '\x17', '\x5d', '\x53', '\x51', '\x37', '\xb0', '\xee', '\x10', '\xcf', '\x9c', '\xe9',
'\x86', '\x52', '\xd3', '\xbf', '\xd2', '\xed', '\x03', '\xeb', '\x5a', '\x14', '\xe6', '\xf4', '\xda', '\x90', '\x33', '\xd0',
'\xaf', '\x68', '\x12', '\x81', '\x99', '\x84', '\x4a', '\xa6', '\xef', '\x64', '\x8e', '\x40', '\x0e', '\x01', '\x8b', '\x86',
'\xf9', '\x86', '\xcb', '\xa6', '\xae', '\x52', '\x10', '\xe6', '\x46', '\x18', '\x6a', '\x52', '\xf7', '\x60', '\xaf', '\xee',
'\x03', '\x30', '\x86', '\xcf', '\xc0', '\xd4', '\x54', '\xdd', '\x05', '\xab', '\xf3', '\x83', '\x3a', '\xb3', '\xac', '\x81',
'\x56', '\x0d', '\x6e', '\x5a', '\xd4', '\x69', '\x33', '\xdf', '\x8f', '\x02', '\x16', '\x75', '\x2a', '\xae', '\xdb', '\x3a',
'\xd2', '\x09', '\x4e', '\x59', '\x64', '\x9f', '\x6a', '\x44', '\x14', '\x86', '\x2c', '\xf0', '\x03', '\xdf', '\x09', '\x69',
'\x95', '\x5f', '\x63', '\x3b', '\xae', '\xf8', '\x0b', '\xf4', '\x8e', '\x7e', '\x01', '\xe9', '\x95', '\x27', '\x97' };
// end paste
@@ -433,34 +443,34 @@ QByteArray RiuDockWidgetTools::defaultGeoMechDockState()
// start paste
static const char stateData[] =
{ '\x00', '\x00', '\x06', '\x4e', '\x78', '\xda', '\x95', '\x55', '\x5d', '\x4f', '\xc2', '\x30', '\x14', '\x7d', '\xf7', '\x57',
'\x34', '\x7b', '\x47', '\x36', '\x36', '\x44', '\x12', '\x3e', '\x42', '\x40', '\x12', '\x1f', '\x50', '\x64', '\x20', '\x8f',
'\xa6', '\x6e', '\x57', '\xa8', '\x76', '\x2d', '\x69', '\x2f', '\x28', '\xc6', '\x1f', '\x6f', '\xc7', '\xc8', '\x12', '\xa0',
'\x6c', '\xf0', '\xb4', '\xee', '\xf6', '\x9c', '\x9e', '\x73', '\x3f', '\xba', '\xb5', '\xba', '\x3f', '\x09', '\x27', '\x1b',
'\x50', '\x9a', '\x49', '\xd1', '\x76', '\xbc', '\x5b', '\xd7', '\x21', '\x20', '\x22', '\x19', '\x33', '\xb1', '\x68', '\x3b',
'\xb3', '\xe9', '\xb0', '\x72', '\xef', '\x74', '\x3b', '\xad', '\x17', '\xec', '\xc5', '\x1b', '\x2a', '\x22', '\x88', '\x07',
'\x32', '\xfa', '\x32', '\x7b', '\xe1', '\x56', '\x23', '\x24', '\xe4', '\x35', '\x27', '\x3a', '\x64', '\xa6', '\x41', '\xe5',
'\xef', '\xbe', '\x43', '\xfa', '\x52', '\x20', '\x65', '\xc2', '\x44', '\x76', '\xdb', '\x7d', '\x10', '\xa8', '\x28', '\x9f',
'\xb3', '\x78', '\x01', '\xd8', '\x76', '\x62', '\x73', '\x8e', '\x3f', '\x98', '\x33', '\x11', '\xcb', '\xef', '\xb7', '\xc4',
'\xe0', '\xb2', '\xa5', '\xd3', '\x69', '\xe5', '\x3c', '\x32', '\xe4', '\x92', '\xe2', '\xce', '\x88', '\x6b', '\xe2', '\xe1',
'\x8a', '\x33', '\x44', '\x13', '\x7e', '\x56', '\xcc', '\x9c', '\x65', '\x76', '\x52', '\xa1', '\xbf', '\x54', '\x68', '\x2d',
'\x30', '\x95', '\x3c', '\x87', '\xa9', '\xe4', '\x98', '\x9a', '\xc1', '\xf4', '\x14', '\x50', '\x32', '\xa5', '\xef', '\x3a',
'\x73', '\xb9', '\x56', '\x0a', '\xc4', '\xde', '\xd0', '\x58', '\xc9', '\x4f', '\x88', '\x70', '\xaa', '\x00', '\x0e', '\x3d',
'\x65', '\xae', '\xc9', '\x13', '\x4d', '\xa0', '\x10', '\x49', '\xfa', '\x5c', '\x6a', '\x88', '\x53', '\xc3', '\x55', '\x0b',
'\x6b', '\x40', '\x91', '\x86', '\x72', '\xad', '\x22', '\xb8', '\x92', '\x18', '\x46', '\x8a', '\xad', '\x50', '\x17', '\xb3',
'\xaa', '\x69', '\x66', '\x07', '\xf9', '\x79', '\xa7', '\xf9', '\xad', '\x40', '\xe1', '\xf6', '\x21', '\x66', '\x28', '\x55',
'\x79', '\x8a', '\x67', '\xc0', '\x56', '\xd9', '\x90', '\xfd', '\x82', '\xee', '\x34', '\x1a', '\x4d', '\x52', '\xf7', '\x3d',
'\xd2', '\xaa', '\x66', '\xef', '\xe6', '\xb9', '\x6f', '\xc9', '\xd5', '\xcd', '\x39', '\x36', '\x6f', '\x9b', '\x16', '\x33',
'\x22', '\x74', '\xb1', '\xc3', '\x5a', '\x12', '\xb0', '\x12', '\xac', '\xd6', '\x2f', '\x98', '\xac', '\x02', '\x63', '\x13',
'\xd0', '\x6b', '\x8e', '\x8f', '\xe2', '\x43', '\x96', '\x54', '\xd4', '\x0e', '\x2c', '\x6b', '\x62', '\x60', '\x95', '\x1b',
'\x73', '\x89', '\x17', '\xc9', '\x1d', '\x03', '\x4b', '\x26', '\x6d', '\x24', '\x97', '\x4a', '\xf7', '\x99', '\x8a', '\x38',
'\x5c', '\xc9', '\x9c', '\x00', '\x1f', '\x83', '\x4a', '\xce', '\xb2', '\x3c', '\x2b', '\x6b', '\xbc', '\xc1', '\x62', '\xc6',
'\x69', '\x41', '\x6a', '\x47', '\x05', '\x19', '\x81', '\xd6', '\x74', '\x01', '\xba', '\xa4', '\x1c', '\x36', '\x58', '\x49',
'\x4a', '\xe6', '\x0a', '\x44', '\x86', '\x35', '\x92', '\xe2', '\x8a', '\x2b', '\x50', '\xaf', '\x79', '\xc4', '\xf3', '\xea',
'\x2e', '\x09', '\xfc', '\x7b', '\xfb', '\x3d', '\xd8', '\x45', '\x9a', '\x6e', '\x40', '\x02', '\xf7', '\xce', '\x8a', '\x28',
'\x18', '\xb6', '\x01', '\xac', '\x70', '\x79', '\x41', '\xf3', '\xad', '\x38', '\x6b', '\x65', '\x33', '\xf9', '\xc0', '\xf7',
'\x49', '\xcd', '\x33', '\xd6', '\x5d', '\xab', '\xa3', '\x6a', '\xfe', '\x55', '\x36', '\xeb', '\x33', '\x7f', '\x83', '\xce',
'\xcd', '\x3f', '\x00', '\xe7', '\x29', '\xe5' };
{ '\x00', '\x00', '\x06', '\x81', '\x78', '\xda', '\x95', '\x55', '\xc1', '\x52', '\xc2', '\x30', '\x10', '\xbd', '\xfb', '\x15',
'\x99', '\xde', '\x95', '\x96', '\x16', '\xe1', '\x50', '\x70', '\x1c', '\xd0', '\xd1', '\x03', '\x5a', '\x29', '\xca', '\xd1',
'\x89', '\xed', '\x8a', '\xd1', '\x34', '\x61', '\x92', '\x2d', '\x8a', '\xe3', '\xc7', '\x9b', '\x52', '\xa7', '\x33', '\x60',
'\x68', '\xe9', '\xa9', '\xc9', '\xe6', '\xbd', '\xbc', '\xb7', '\x9b', '\x4d', '\x1a', '\x5e', '\x7c', '\x65', '\x9c', '\xac',
'\x41', '\x69', '\x26', '\xc5', '\xd0', '\xf1', '\xce', '\x5c', '\x87', '\x80', '\x48', '\x64', '\xca', '\xc4', '\x72', '\xe8',
'\x3c', '\xce', '\xaf', '\x4f', '\x07', '\xce', '\xc5', '\x28', '\x7c', '\xc0', '\xcb', '\x74', '\x4d', '\x45', '\x02', '\xe9',
'\x44', '\x26', '\x1f', '\x66', '\x2d', '\xde', '\x68', '\x84', '\x8c', '\x3c', '\x55', '\x44', '\x87', '\x3c', '\x6a', '\x50',
'\xd5', '\xdc', '\x77', '\xc8', '\x58', '\x0a', '\xa4', '\x4c', '\x98', '\xc8', '\x76', '\x79', '\x0c', '\x02', '\x15', '\xe5',
'\x0b', '\x96', '\x2e', '\x01', '\x87', '\x4e', '\x6a', '\xf6', '\xf1', '\x27', '\x0b', '\x26', '\x52', '\xf9', '\xf9', '\x9c',
'\x19', '\x5c', '\x39', '\x74', '\x46', '\x61', '\xc5', '\x23', '\xd7', '\x5c', '\x52', '\xdc', '\x1a', '\x71', '\x4d', '\x3c',
'\x5e', '\x71', '\x86', '\x68', '\xc2', '\xf7', '\x8a', '\x99', '\xbd', '\xcc', '\x4a', '\x21', '\xf4', '\x53', '\x08', '\xe5',
'\x02', '\x0b', '\xc9', '\x43', '\x98', '\xd3', '\x0a', '\xd3', '\x35', '\x98', '\x4b', '\x05', '\x94', '\xcc', '\xe9', '\x8b',
'\x2e', '\x5d', '\xe6', '\x4a', '\x81', '\xf8', '\x33', '\x14', '\x29', '\xf9', '\x0e', '\x09', '\xce', '\x15', '\xc0', '\xae',
'\xa7', '\xd2', '\x35', '\xb9', '\xa3', '\x19', '\xd4', '\x22', '\xc9', '\x98', '\x4b', '\x0d', '\x69', '\x61', '\xb8', '\x63',
'\x61', '\x4d', '\x28', '\xd2', '\x58', '\xe6', '\x2a', '\x81', '\x96', '\xc4', '\x38', '\x51', '\x6c', '\x85', '\xba', '\x9e',
'\xd5', '\x29', '\x32', '\xdb', '\xc9', '\xcf', '\xfb', '\x9f', '\xdf', '\x0a', '\x14', '\x6e', '\xae', '\x52', '\x86', '\x52',
'\x35', '\xa7', '\x78', '\x00', '\x6c', '\x95', '\x8d', '\xd9', '\x37', '\xe8', '\x51', '\x3f', '\xf0', '\x49', '\xcf', '\xed',
'\x93', '\xb0', '\x53', '\xce', '\xcd', '\xf7', '\xef', '\x48', '\x5a', '\x1f', '\xce', '\xbe', '\x79', '\x5b', '\xb7', '\x98',
'\x16', '\xa1', '\xcb', '\x2d', '\xd6', '\x92', '\x80', '\x95', '\x60', '\xb5', '\x7e', '\x44', '\x67', '\xd5', '\x18', '\x9b',
'\x81', '\xce', '\x39', '\xde', '\x8a', '\x57', '\xd9', '\x50', '\x51', '\x3b', '\xb0', '\xe9', '\x10', '\x7b', '\x56', '\xb9',
'\x88', '\x4b', '\x3c', '\x4a', '\x6e', '\x1f', '\xd8', '\xd0', '\x69', '\x53', '\xf9', '\xa6', '\xf4', '\x98', '\xa9', '\x84',
'\x43', '\x4b', '\x66', '\x0c', '\x4c', '\xdf', '\x30', '\xdd', '\x86', '\x32', '\x03', '\x1e', '\x81', '\xca', '\x0e', '\x0a',
'\x79', '\x56', '\x56', '\xb4', '\xc6', '\x7a', '\xc6', '\xff', '\x1a', '\x76', '\xf7', '\x6a', '\x38', '\x05', '\xad', '\xe9',
'\x12', '\x74', '\x43', '\x05', '\x6d', '\xb0', '\x86', '\x94', '\xcc', '\xad', '\x49', '\x0c', '\x6b', '\x2a', '\x45', '\x8b',
'\x5b', '\xd3', '\xeb', '\x7a', '\xc4', '\xf3', '\x7a', '\x2e', '\x09', '\xfc', '\x81', '\xfd', '\xea', '\x6c', '\x23', '\x83',
'\x20', '\x20', '\x81', '\x7b', '\x6e', '\x45', '\xd4', '\xf4', '\xe7', '\x04', '\x56', '\xf8', '\x76', '\x44', '\xbf', '\x58',
'\x71', '\xd6', '\xca', '\x96', '\xf2', '\x81', '\xef', '\x93', '\xae', '\x67', '\xac', '\xbb', '\x56', '\x47', '\x9d', '\xea',
'\x21', '\x37', '\xe3', '\x03', '\x3f', '\x90', '\xd1', '\xc9', '\x2f', '\xd6', '\xef', '\x3b', '\x86' };
// end paste

View File

@@ -54,6 +54,7 @@ public:
static QString mainWindowDepthPlotName();
static QString mainWindowRelPermPlotName();
static QString mainWindowPvtPlotName();
static QString mainWindowSeismicHistogramName();
static QString mainWindowMessagesName();
static QString mainWindowMohrsCirclePlotName();
static QString mainWindowUndoStackName();

View File

@@ -158,8 +158,7 @@ private:
std::vector<T*> typedAncestorsVec;
for ( size_t i = 0; i < m_objects.size(); i++ )
{
T* typedAncestor = nullptr;
m_objects[i]->firstAncestorOfType( typedAncestor );
auto typedAncestor = m_objects[i]->firstAncestorOfType<T>();
if ( typedAncestor )
{
typedAncestorsVec.push_back( typedAncestor );
@@ -246,14 +245,14 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
caf::PdmObject* pdmObj = dynamic_cast<caf::PdmObject*>( uiItem );
if ( pdmObj )
{
RimWellAllocationPlot* wellAllocationPlot = nullptr;
pdmObj->firstAncestorOrThisOfType( wellAllocationPlot );
auto wellAllocationPlot = pdmObj->firstAncestorOrThisOfType<RimWellAllocationPlot>();
if ( wellAllocationPlot ) return itemflags;
}
if ( dynamic_cast<RimEclipseCase*>( uiItem ) || dynamic_cast<RimWellLogCurve*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlot*>( uiItem ) ||
dynamic_cast<RimSummaryCase*>( uiItem ) || dynamic_cast<RimSummaryCurve*>( uiItem ) || dynamic_cast<RimSurface*>( uiItem ) )
dynamic_cast<RimSummaryCase*>( uiItem ) || dynamic_cast<RimSummaryCaseCollection*>( uiItem ) ||
dynamic_cast<RimSummaryCurve*>( uiItem ) || dynamic_cast<RimSurface*>( uiItem ) )
{
itemflags |= Qt::ItemIsDragEnabled;
}
@@ -399,57 +398,49 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in
dropTargetIndex.parent(),
RiuTypedPdmObjects<const caf::PdmUiItem>::typedObjectsFromGroup( draggedObjects ) );
RimIdenticalGridCaseGroup* gridCaseGroup;
dropTarget->firstAncestorOrThisOfType( gridCaseGroup );
auto gridCaseGroup = dropTarget->firstAncestorOrThisOfType<RimIdenticalGridCaseGroup>();
if ( gridCaseGroup )
{
return handleGridCaseGroupDrop( action, draggedObjects, gridCaseGroup );
}
RimWellLogTrack* wellLogPlotTrack;
dropTarget->firstAncestorOrThisOfType( wellLogPlotTrack );
auto wellLogPlotTrack = dropTarget->firstAncestorOrThisOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack, row );
}
RimWellLogPlot* wellLogPlot;
dropTarget->firstAncestorOrThisOfType( wellLogPlot );
auto wellLogPlot = dropTarget->firstAncestorOrThisOfType<RimWellLogPlot>();
if ( wellLogPlot )
{
return handleWellLogPlotDrop( action, draggedObjects, wellLogPlot, row );
}
RimSummaryPlot* summaryPlot;
dropTarget->firstAncestorOrThisOfType( summaryPlot );
auto summaryPlot = dropTarget->firstAncestorOrThisOfType<RimSummaryPlot>();
if ( summaryPlot )
{
return handleSummaryPlotDrop( action, draggedObjects, summaryPlot, row );
}
RimMultiPlot* multiPlot;
dropTarget->firstAncestorOrThisOfType( multiPlot );
auto multiPlot = dropTarget->firstAncestorOrThisOfType<RimMultiPlot>();
if ( multiPlot )
{
return handleMultiPlotDrop( action, draggedObjects, multiPlot, row );
}
RimSummaryCaseCollection* summaryCaseCollection;
dropTarget->firstAncestorOrThisOfType( summaryCaseCollection );
auto summaryCaseCollection = dropTarget->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
if ( summaryCaseCollection )
{
return handleSummaryCaseCollectionDrop( action, draggedObjects, summaryCaseCollection );
}
RimSummaryCaseMainCollection* summaryCaseMainCollection;
dropTarget->firstAncestorOrThisOfType( summaryCaseMainCollection );
auto summaryCaseMainCollection = dropTarget->firstAncestorOrThisOfType<RimSummaryCaseMainCollection>();
if ( summaryCaseMainCollection )
{
return handleSummaryCaseMainCollectionDrop( action, draggedObjects, summaryCaseMainCollection );
}
RimSurfaceCollection* surfaceCollection;
dropTarget->firstAncestorOrThisOfType( surfaceCollection );
auto surfaceCollection = dropTarget->firstAncestorOrThisOfType<RimSurfaceCollection>();
if ( surfaceCollection )
{
return handleSurfaceCollectionDrop( action, row, draggedObjects, surfaceCollection );
@@ -624,8 +615,7 @@ bool RiuDragDrop::handleSummaryCaseCollectionDrop( Qt::DropAction act
for ( RimSummaryCase* summaryCase : summaryCases )
{
RimSummaryCaseCollection* summaryCaseCollection;
summaryCase->firstAncestorOrThisOfType( summaryCaseCollection );
auto summaryCaseCollection = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
if ( summaryCaseCollection )
{
@@ -635,8 +625,7 @@ bool RiuDragDrop::handleSummaryCaseCollectionDrop( Qt::DropAction act
continue;
}
RimSummaryCaseMainCollection* summaryCaseMainCollection;
summaryCase->firstAncestorOrThisOfType( summaryCaseMainCollection );
auto summaryCaseMainCollection = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseMainCollection>();
if ( summaryCaseMainCollection )
{
summaryCaseMainCollection->removeCase( summaryCase );
@@ -661,8 +650,7 @@ bool RiuDragDrop::handleSummaryCaseMainCollectionDrop( Qt::DropAction
for ( RimSummaryCase* summaryCase : summaryCases )
{
RimSummaryCaseCollection* summaryCaseCollection;
summaryCase->firstAncestorOrThisOfType( summaryCaseCollection );
auto summaryCaseCollection = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
if ( summaryCaseCollection )
{
@@ -734,8 +722,7 @@ bool RiuDragDrop::handleSurfaceCollectionDrop( Qt::DropAction action, int row, c
for ( RimSurface* surface : surfaces )
{
RimSurfaceCollection* sourceCollection;
surface->firstAncestorOrThisOfType( sourceCollection );
auto sourceCollection = surface->firstAncestorOrThisOfType<RimSurfaceCollection>();
if ( sourceCollection )
{

View File

@@ -158,7 +158,11 @@ void RiuFemTimeHistoryResultAccessor::computeTimeHistoryData()
const int frameCount = femPartResultsColl->frameCount( stepIdx );
for ( int frameIdx = 0; frameIdx < frameCount; frameIdx++ )
{
RiuGeoMechXfTensorResultAccessor stressXfAccessor( femPartResultsColl, *m_femResultAddress, m_gridIndex, stepIdx, frameIdx );
RiuGeoMechXfTensorResultAccessor stressXfAccessor( femPartResultsColl,
*m_femResultAddress,
static_cast<int>( m_gridIndex ),
stepIdx,
frameIdx );
float scalarValue = stressXfAccessor.calculateElmNodeValue( m_intersectionTriangle, closestElmNodeResIndex );
m_timeHistoryValues.push_back( scalarValue );
}

View File

@@ -237,8 +237,7 @@ bool RiuGridCrossQwtPlot::curveText( const QwtPlotCurve* curve, QString* curveTi
{
*curveTitle = crossPlotCurve->curveName();
RimGridCrossPlotDataSet* dataSet = nullptr;
crossPlotCurve->firstAncestorOrThisOfType( dataSet );
auto dataSet = crossPlotCurve->firstAncestorOrThisOfType<RimGridCrossPlotDataSet>();
if ( dataSet )
{
*xParamName = dataSet->xAxisName();

View File

@@ -55,7 +55,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
{ { QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::curve\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
"?<properties>([\\n\\r]*\\s*((line-color|symbol-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
@@ -114,7 +115,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::grid\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
@@ -151,7 +153,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::legend\\s*\\{("
"?<properties>([\\n\\r]*\\s*((text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
@@ -184,7 +187,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color|text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
@@ -237,7 +241,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color|text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
@@ -292,7 +297,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression textColorRegExp( "text-color:\\s*([#a-zA-Z0-9]+)" );
@@ -457,8 +463,8 @@ QString RiuGuiTheme::applyVariableValueMapToStyleSheet( RiaDefines::ThemeEnum th
{
styleSheet = styleSheetFile.readAll();
QRegularExpression variableRegExp( "(?<prefix>[ \\t]*(?<name>\\$[a-zA-z0-9_]+)[ \\t]*:[ "
"\\t]*)(?<value>[a-zA-Z-_0-9#]+)(?<suffix>;[ \\t]*(\\/\\/[ "
"\\t]*(?<descriptor>(.*)))?)" );
"\\t]*)(?<value>[a-zA-Z-_0-9#]+)(?<suffix>;[ \\t]*(\\/\\/[ "
"\\t]*(?<descriptor>(.*)))?)" );
QRegularExpressionMatchIterator matchIterator = variableRegExp.globalMatch( styleSheet );
while ( matchIterator.hasNext() )
{

View File

@@ -38,7 +38,7 @@ class QwtPlotCurve;
class QwtPicker;
class QwtText;
typedef std::function<void( QRegularExpressionMatch& )> CustomStyleSheetApplicator;
using CustomStyleSheetApplicator = std::function<void( QRegularExpressionMatch& )>;
class RiuGuiTheme
{

View File

@@ -54,6 +54,7 @@
#include "RiuDockWidgetTools.h"
#include "RiuMdiArea.h"
#include "RiuMdiSubWindow.h"
#include "RiuMenuBarBuildTools.h"
#include "RiuMessagePanel.h"
#include "RiuMohrsCirclePlot.h"
#include "RiuProcessMonitor.h"
@@ -63,6 +64,7 @@
#include "RiuRelativePermeabilityPlotPanel.h"
#include "RiuResultInfoPanel.h"
#include "RiuResultQwtPlot.h"
#include "RiuSeismicHistogramPanel.h"
#include "RiuToolTipMenu.h"
#include "RiuTools.h"
#include "RiuTreeViewEventFilter.h"
@@ -128,6 +130,7 @@ RiuMainWindow::RiuMainWindow()
, m_pvtPlotPanel( nullptr )
, m_mohrsCirclePlot( nullptr )
, m_holoLensToolBar( nullptr )
, m_seismicHistogramPanel( nullptr )
{
setAttribute( Qt::WA_DeleteOnClose );
@@ -262,6 +265,7 @@ void RiuMainWindow::cleanupGuiCaseClose()
if ( m_relPermPlotPanel ) m_relPermPlotPanel->clearPlot();
if ( m_pvtPlotPanel ) m_pvtPlotPanel->clearPlot();
if ( m_mohrsCirclePlot ) m_mohrsCirclePlot->clearPlot();
if ( m_seismicHistogramPanel ) m_seismicHistogramPanel->clearPlot();
if ( m_pdmUiPropertyView )
{
@@ -347,6 +351,11 @@ void RiuMainWindow::createActions()
connect( m_executePaintEventPerformanceTest, SIGNAL( triggered() ), SLOT( slotExecutePaintEventPerformanceTest() ) );
// View actions
m_viewFullScreen = new QAction( QIcon( ":/Fullscreen.png" ), "Full Screen", this );
m_viewFullScreen->setToolTip( "Full Screen (Ctrl+Alt+F)" );
m_viewFullScreen->setCheckable( true );
caf::CmdFeature::applyShortcutWithHintToAction( m_viewFullScreen, QKeySequence( tr( "Ctrl+Alt+F" ) ) );
m_viewFromNorth = new QAction( QIcon( ":/SouthView.svg" ), "Look South", this );
m_viewFromNorth->setToolTip( "Look South (Ctrl+Alt+S)" );
caf::CmdFeature::applyShortcutWithHintToAction( m_viewFromNorth, QKeySequence( tr( "Ctrl+Alt+S" ) ) );
@@ -377,6 +386,7 @@ void RiuMainWindow::createActions()
connect( m_viewFromWest, SIGNAL( triggered() ), SLOT( slotViewFromWest() ) );
connect( m_viewFromAbove, SIGNAL( triggered() ), SLOT( slotViewFromAbove() ) );
connect( m_viewFromBelow, SIGNAL( triggered() ), SLOT( slotViewFromBelow() ) );
connect( m_viewFullScreen, SIGNAL( toggled( bool ) ), SLOT( slotViewFullScreen( bool ) ) );
// Debug actions
m_newPropertyView = new QAction( "New Project and Property View", this );
@@ -431,59 +441,13 @@ void RiuMainWindow::createMenus()
CVF_ASSERT( cmdFeatureMgr );
// File menu
QMenu* fileMenu = new RiuToolTipMenu( menuBar() );
fileMenu->setTitle( "&File" );
menuBar()->addMenu( fileMenu );
fileMenu->addAction( cmdFeatureMgr->action( "RicOpenProjectFeature" ) );
fileMenu->addAction( cmdFeatureMgr->action( "RicOpenLastUsedFileFeature" ) );
QMenu* fileMenu = RiuMenuBarBuildTools::createDefaultFileMenu( menuBar() );
fileMenu->addSeparator();
QMenu* importMenu = fileMenu->addMenu( "&Import" );
QMenu* importEclipseMenu = importMenu->addMenu( QIcon( ":/Case48x48.png" ), "Eclipse Cases" );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCaseFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCasesFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCaseTimeStepFilterFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportInputEclipseCaseFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicCreateGridCaseGroupFromFilesFeature" ) );
QMenu* importRoffMenu = importMenu->addMenu( QIcon( ":/Case48x48.png" ), "Roff Grid Models" );
importRoffMenu->addAction( cmdFeatureMgr->action( "RicImportRoffCaseFeature" ) );
importMenu->addSeparator();
QMenu* importSummaryMenu = importMenu->addMenu( QIcon( ":/SummaryCase.svg" ), "Summary Cases" );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryCaseFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryCasesFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryGroupFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleFeature" ) );
#ifdef USE_ODB_API
importMenu->addSeparator();
QMenu* importGeoMechMenu = importMenu->addMenu( QIcon( ":/GeoMechCase24x24.png" ), "Geo Mechanical Cases" );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseFeature" ) );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseTimeStepFilterFeature" ) );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportElementPropertyFeature" ) );
#endif
importMenu->addSeparator();
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportSsihubFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellLogsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathFormationsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportWellMeasurementsFeature" ) );
importMenu->addSeparator();
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportPressureDepthDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportFormationNamesFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportSurfacesFeature" ) );
RiuTools::enableAllActionsOnShow( this, importMenu );
// Import menu actions
RiuMenuBarBuildTools::addImportMenuWithActions( this, fileMenu );
// Export menu actions
QMenu* exportMenu = fileMenu->addMenu( "&Export" );
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToFileFeature" ) );
exportMenu->addAction( m_snapshotAllViewsToFile );
@@ -494,9 +458,9 @@ void RiuMainWindow::createMenus()
exportMenu->addAction( cmdFeatureMgr->action( "RicExportCompletionsForVisibleWellPathsFeature" ) );
exportMenu->addAction( cmdFeatureMgr->action( "RicExportVisibleWellPathsFeature" ) );
// Save menu actions
fileMenu->addSeparator();
fileMenu->addAction( cmdFeatureMgr->action( "RicSaveProjectFeature" ) );
fileMenu->addAction( cmdFeatureMgr->action( "RicSaveProjectAsFeature" ) );
RiuMenuBarBuildTools::addSaveProjectActions( fileMenu );
std::vector<QAction*> recentFileActions = RiaGuiApplication::instance()->recentFileActions();
for ( auto act : recentFileActions )
@@ -507,33 +471,26 @@ void RiuMainWindow::createMenus()
fileMenu->addSeparator();
QMenu* testMenu = fileMenu->addMenu( "&Testing" );
// Close and Exit actions
fileMenu->addSeparator();
fileMenu->addAction( cmdFeatureMgr->action( "RicCloseProjectFeature" ) );
fileMenu->addSeparator();
fileMenu->addAction( cmdFeatureMgr->action( "RicExitApplicationFeature" ) );
RiuMenuBarBuildTools::addCloseAndExitActions( fileMenu );
connect( fileMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshFileActions() ) );
// Edit menu
QMenu* editMenu = menuBar()->addMenu( "&Edit" );
editMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToClipboardFeature" ) );
editMenu->addSeparator();
editMenu->addAction( cmdFeatureMgr->action( "RicShowMemoryCleanupDialogFeature" ) );
editMenu->addSeparator();
editMenu->addAction( cmdFeatureMgr->action( "RicEditPreferencesFeature" ) );
QMenu* editMenu = RiuMenuBarBuildTools::createDefaultEditMenu( menuBar() );
if ( RiaPreferences::current()->useUndoRedo() )
{
editMenu->addSeparator();
editMenu->addAction( m_undoAction );
editMenu->addAction( m_redoAction );
}
connect( editMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshUndoRedoActions() ) );
// View menu
QMenu* viewMenu = menuBar()->addMenu( "&View" );
viewMenu->addAction( cmdFeatureMgr->action( "RicViewZoomAllFeature" ) );
QMenu* viewMenu = RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() );
viewMenu->addSeparator();
viewMenu->addAction( m_viewFullScreen );
viewMenu->addSeparator();
viewMenu->addAction( m_viewFromSouth );
viewMenu->addAction( m_viewFromNorth );
@@ -544,6 +501,7 @@ void RiuMainWindow::createMenus()
connect( viewMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshViewActions() ) );
// Test menu
testMenu->addAction( m_mockModelAction );
testMenu->addAction( m_mockResultsModelAction );
testMenu->addAction( m_mockLargeResultsModelAction );
@@ -561,12 +519,10 @@ void RiuMainWindow::createMenus()
testMenu->addAction( cmdFeatureMgr->action( "RicExecuteLastUsedScriptFeature" ) );
testMenu->addSeparator();
testMenu->addAction( cmdFeatureMgr->action( "RicHoloLensExportToFolderFeature" ) );
testMenu->addAction( cmdFeatureMgr->action( "RicHoloLensCreateDummyFiledBackedSessionFeature" ) );
testMenu->addSeparator();
testMenu->addAction( cmdFeatureMgr->action( "RicThemeColorEditorFeature" ) );
// Windows menu
@@ -574,16 +530,7 @@ void RiuMainWindow::createMenus()
connect( m_windowMenu, SIGNAL( aboutToShow() ), SLOT( slotBuildWindowActions() ) );
// Help menu
QMenu* helpMenu = menuBar()->addMenu( "&Help" );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpAboutFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpCommandLineFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpSummaryCommandLineFeature" ) );
helpMenu->addSeparator();
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchIssuesHelpFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicCreateNewIssueHelpFeature" ) );
QMenu* helpMenu = RiuMenuBarBuildTools::createDefaultHelpMenu( menuBar() );
connect( helpMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshHelpActions() ) );
}
@@ -656,6 +603,7 @@ void RiuMainWindow::createToolBars()
toolbar->setObjectName( toolbar->windowTitle() );
toolbar->addAction( cmdFeatureMgr->action( "RicTogglePerspectiveViewFeature" ) );
toolbar->addAction( cmdFeatureMgr->action( "RicViewZoomAllFeature" ) );
toolbar->addAction( m_viewFullScreen );
toolbar->addAction( m_viewFromNorth );
toolbar->addAction( m_viewFromSouth );
toolbar->addAction( m_viewFromEast );
@@ -871,6 +819,15 @@ void RiuMainWindow::createDockPanels()
dockManager()->addDockWidgetTabToArea( dockWidget, bottomArea );
}
{
auto dockWidget =
RiuDockWidgetTools::createDockWidget( "Seismic Histogram", RiuDockWidgetTools::mainWindowSeismicHistogramName(), dockManager() );
m_seismicHistogramPanel = new RiuSeismicHistogramPanel( dockWidget );
dockWidget->setWidget( m_seismicHistogramPanel );
dockManager()->addDockWidgetTabToArea( dockWidget, bottomArea );
}
// result info
{
auto dockWidget = RiuDockWidgetTools::createDockWidget( "Result Info", RiuDockWidgetTools::mainWindowResultInfoName(), dockManager() );
@@ -1133,8 +1090,7 @@ RimViewWindow* RiuMainWindow::findViewWindowFromSubWindow( QMdiSubWindow* subWin
{
if ( subWindow )
{
std::vector<RimViewWindow*> allViewWindows;
RimProject::current()->descendantsIncludingThisOfType( allViewWindows );
std::vector<RimViewWindow*> allViewWindows = RimProject::current()->descendantsIncludingThisOfType<RimViewWindow>();
for ( RimViewWindow* viewWindow : allViewWindows )
{
@@ -1195,6 +1151,14 @@ RiuMohrsCirclePlot* RiuMainWindow::mohrsCirclePlot()
return m_mohrsCirclePlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSeismicHistogramPanel* RiuMainWindow::seismicHistogramPanel()
{
return m_seismicHistogramPanel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1271,6 +1235,22 @@ void RiuMainWindow::slotViewFromNorth()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFullScreen( bool showFullScreen )
{
if ( showFullScreen )
{
m_lastDockState = dockManager()->saveState( DOCKSTATE_VERSION );
dockManager()->restoreState( RiuDockWidgetTools::hideAllDocking3DState(), DOCKSTATE_VERSION );
}
else
{
dockManager()->restoreState( m_lastDockState, DOCKSTATE_VERSION );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1373,9 +1353,7 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
if ( !is3dViewCurrentlySelected )
{
std::vector<RimEclipseCellColors*> objects;
activatedView->descendantsIncludingThisOfType( objects );
std::vector<RimEclipseCellColors*> objects = activatedView->descendantsIncludingThisOfType<RimEclipseCellColors>();
if ( !objects.empty() )
{
auto candidate = tv->findModelIndex( objects.front() );
@@ -1486,6 +1464,8 @@ void RiuMainWindow::selectedObjectsChanged()
m_pdmUiPropertyView->showProperties( firstSelectedObject );
m_seismicHistogramPanel->showHistogram( firstSelectedObject );
if ( uiItems.size() == 1 && m_allowActiveViewChangeFromSelection )
{
// Find the reservoir view or the Plot that the selected item is within
@@ -1502,7 +1482,7 @@ void RiuMainWindow::selectedObjectsChanged()
Rim3dView* selectedReservoirView = dynamic_cast<Rim3dView*>( firstSelectedObject );
if ( !selectedReservoirView )
{
firstSelectedObject->firstAncestorOrThisOfType( selectedReservoirView );
selectedReservoirView = firstSelectedObject->firstAncestorOrThisOfType<Rim3dView>();
}
bool isActiveViewChanged = false;
@@ -1627,13 +1607,13 @@ void RiuMainWindow::slotToggleFaultLabelsAction( bool showLabels )
Rim2dIntersectionView* isectView = dynamic_cast<Rim2dIntersectionView*>( activeView );
if ( isectView )
{
isectView->intersection()->firstAncestorOrThisOfType( activeRiv );
activeRiv = isectView->intersection()->firstAncestorOrThisOfType<RimEclipseView>();
}
}
if ( !activeRiv ) return;
activeRiv->faultCollection()->showFaultLabel.setValueWithFieldChanged( showLabels );
activeRiv->faultCollection()->setShowFaultLabelWithFieldChanged( showLabels );
refreshDrawStyleActions();
}
@@ -1700,7 +1680,7 @@ void RiuMainWindow::refreshDrawStyleActions()
Rim2dIntersectionView* intView = dynamic_cast<Rim2dIntersectionView*>( view );
if ( intView && intView->intersection() )
{
intView->intersection()->firstAncestorOrThisOfType( eclView );
eclView = intView->intersection()->firstAncestorOrThisOfType<RimEclipseView>();
}
}
@@ -1858,6 +1838,10 @@ void RiuMainWindow::applyFontSizesToDockedPlots()
{
m_pvtPlotPanel->applyFontSizes( true );
}
if ( m_seismicHistogramPanel )
{
m_seismicHistogramPanel->applyFontSizes( true );
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -54,6 +54,7 @@ class RiuRelativePermeabilityPlotPanel;
class RiuPvtPlotPanel;
class RiuMohrsCirclePlot;
class RiuMdiArea;
class RiuSeismicHistogramPanel;
class RicGridCalculatorDialog;
@@ -128,6 +129,7 @@ public:
RiuRelativePermeabilityPlotPanel* relativePermeabilityPlotPanel();
RiuPvtPlotPanel* pvtPlotPanel();
RiuMohrsCirclePlot* mohrsCirclePlot();
RiuSeismicHistogramPanel* seismicHistogramPanel();
RiuMessagePanel* messagePanel();
void showProcessMonitorDockPanel();
@@ -165,6 +167,7 @@ private:
QAction* m_viewFromWest;
QAction* m_viewFromAbove;
QAction* m_viewFromBelow;
QAction* m_viewFullScreen;
// Mock actions
QAction* m_mockModelAction;
@@ -189,6 +192,7 @@ private:
RiuDepthQwtPlot* m_depthQwtPlot;
RiuMohrsCirclePlot* m_mohrsCirclePlot;
RiuRelativePermeabilityPlotPanel* m_relPermPlotPanel;
RiuSeismicHistogramPanel* m_seismicHistogramPanel;
RiuPvtPlotPanel* m_pvtPlotPanel;
std::unique_ptr<RicGridCalculatorDialog> m_gridCalculatorDialog;
@@ -213,6 +217,7 @@ private slots:
// View slots
void slotRefreshViewActions();
void slotViewFullScreen( bool );
void slotViewFromNorth();
void slotViewFromSouth();
void slotViewFromEast();

View File

@@ -24,14 +24,16 @@
#include "RiaRegressionTestRunner.h"
#include "RiaVersionInfo.h"
#include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuMdiArea.h"
#include "RiuMdiSubWindow.h"
#include "RimProject.h"
#include "RimViewWindow.h"
#include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuGuiTheme.h"
#include "RiuMainWindowTools.h"
#include "RiuMdiArea.h"
#include "RiuMdiSubWindow.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmObject.h"
#include "cafPdmUiTreeView.h"
@@ -52,8 +54,6 @@
#include <QUndoStack>
#include <QUndoView>
#define DOCKSTATE_VERSION 3
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -67,6 +67,7 @@ RiuMainWindowBase::RiuMainWindowBase()
{
ads::CDockManager::setAutoHideConfigFlags( ads::CDockManager::DefaultAutoHideConfig );
m_dockManager = new ads::CDockManager( this );
m_dockManager->setStyleSheet( "" );
if ( RiaPreferences::current()->useUndoRedo() && RiaApplication::enableDevelopmentFeatures() )
{
@@ -84,6 +85,13 @@ RiuMainWindowBase::RiuMainWindowBase()
m_redoAction = new QAction( QIcon( ":/redo.png" ), tr( "Redo" ), this );
m_redoAction->setShortcut( QKeySequence::Redo );
connect( m_redoAction, SIGNAL( triggered() ), SLOT( slotRedo() ) );
#ifdef Q_OS_WIN
if ( RiaPreferences::current()->guiTheme() == RiaDefines::ThemeEnum::DARK )
{
RiuMainWindowTools::setDarkTitleBarWindows( this );
}
#endif
}
//--------------------------------------------------------------------------------------------------
@@ -184,6 +192,8 @@ void RiuMainWindowBase::loadWinGeoAndDockToolBarLayout()
}
}
m_lastDockState = m_dockManager->saveState( DOCKSTATE_VERSION );
settings.beginGroup( registryFolderName() );
m_dockManager->loadPerspectives( settings );
}

View File

@@ -18,6 +18,7 @@
#pragma once
#include <QByteArray>
#include <QMainWindow>
#include "cafPdmUiDragDropInterface.h"
@@ -140,6 +141,10 @@ protected:
RiuMdiArea* m_mdiArea;
QMenu* m_windowMenu;
const int DOCKSTATE_VERSION = 3;
QByteArray m_lastDockState;
private:
QString registryFolderName();

View File

@@ -39,6 +39,88 @@
#include <QMdiSubWindow>
#include <QModelIndex>
// Dark title bar is taken from
// https://envyen.com/posts/2021-10-24-QT-Windows-Dark-theme/
#ifdef Q_OS_WIN
#include <Windows.h>
#include <dwmapi.h>
#pragma comment( lib, "Dwmapi.lib" )
enum PreferredAppMode
{
Default,
AllowDark,
ForceDark,
ForceLight,
Max
};
enum WINDOWCOMPOSITIONATTRIB
{
WCA_UNDEFINED = 0,
WCA_NCRENDERING_ENABLED = 1,
WCA_NCRENDERING_POLICY = 2,
WCA_TRANSITIONS_FORCEDISABLED = 3,
WCA_ALLOW_NCPAINT = 4,
WCA_CAPTION_BUTTON_BOUNDS = 5,
WCA_NONCLIENT_RTL_LAYOUT = 6,
WCA_FORCE_ICONIC_REPRESENTATION = 7,
WCA_EXTENDED_FRAME_BOUNDS = 8,
WCA_HAS_ICONIC_BITMAP = 9,
WCA_THEME_ATTRIBUTES = 10,
WCA_NCRENDERING_EXILED = 11,
WCA_NCADORNMENTINFO = 12,
WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,
WCA_VIDEO_OVERLAY_ACTIVE = 14,
WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,
WCA_DISALLOW_PEEK = 16,
WCA_CLOAK = 17,
WCA_CLOAKED = 18,
WCA_ACCENT_POLICY = 19,
WCA_FREEZE_REPRESENTATION = 20,
WCA_EVER_UNCLOAKED = 21,
WCA_VISUAL_OWNER = 22,
WCA_HOLOGRAPHIC = 23,
WCA_EXCLUDED_FROM_DDA = 24,
WCA_PASSIVEUPDATEMODE = 25,
WCA_USEDARKMODECOLORS = 26,
WCA_LAST = 27
};
struct WINDOWCOMPOSITIONATTRIBDATA
{
WINDOWCOMPOSITIONATTRIB Attrib;
PVOID pvData;
SIZE_T cbData;
};
using fnAllowDarkModeForWindow = BOOL( WINAPI* )( HWND hWnd, BOOL allow );
using fnSetPreferredAppMode = PreferredAppMode( WINAPI* )( PreferredAppMode appMode );
using fnSetWindowCompositionAttribute = BOOL( WINAPI* )( HWND hwnd, WINDOWCOMPOSITIONATTRIBDATA* );
static void setDarkTitlebar( HWND hwnd )
{
HMODULE hUxtheme = LoadLibraryExW( L"uxtheme.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32 );
if ( !hUxtheme ) return;
HMODULE hUser32 = GetModuleHandleW( L"user32.dll" );
if ( !hUser32 ) return;
fnAllowDarkModeForWindow AllowDarkModeForWindow =
reinterpret_cast<fnAllowDarkModeForWindow>( GetProcAddress( hUxtheme, MAKEINTRESOURCEA( 133 ) ) );
fnSetPreferredAppMode SetPreferredAppMode = reinterpret_cast<fnSetPreferredAppMode>( GetProcAddress( hUxtheme, MAKEINTRESOURCEA( 135 ) ) );
fnSetWindowCompositionAttribute SetWindowCompositionAttribute =
reinterpret_cast<fnSetWindowCompositionAttribute>( GetProcAddress( hUser32, "SetWindowCompositionAttribute" ) );
SetPreferredAppMode( AllowDark );
BOOL dark = TRUE;
AllowDarkModeForWindow( hwnd, dark );
WINDOWCOMPOSITIONATTRIBDATA data = { WCA_USEDARKMODECOLORS, &dark, sizeof( dark ) };
SetWindowCompositionAttribute( hwnd, &data );
}
#endif
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -156,3 +238,15 @@ void RiuMainWindowTools::setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWi
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindowTools::setDarkTitleBarWindows( QWidget* widget )
{
if ( !widget ) return;
#ifdef Q_OS_WIN
setDarkTitlebar( reinterpret_cast<HWND>( widget->winId() ) );
#endif
}

View File

@@ -24,7 +24,7 @@ class PdmUiItem;
} // namespace caf
class RiuMainWindowBase;
class QWidget;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -35,4 +35,5 @@ public:
static void setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height );
static void setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWindow, int width, int height );
static void setDarkTitleBarWindows( QWidget* widget );
};

View File

@@ -0,0 +1,463 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuMatrixPlotWidget.h"
#include "RiaColorTools.h"
#include "RiaPreferences.h"
#include "RimRegularLegendConfig.h"
#include "RimViewWindow.h"
#include "RiuAbstractLegendFrame.h"
#include "RiuCategoryLegendFrame.h"
#include "RiuQwtLinearScaleEngine.h"
#include "RiuQwtPlotItem.h"
#include "RiuQwtPlotTools.h"
#include "RiuScalarMapperLegendFrame.h"
#include "cvfColor3.h"
#include "qwt_plot_marker.h"
#include "qwt_scale_draw.h"
#include "qwt_text.h"
#include <QHBoxLayout>
class MatrixShapeItem : public QwtPlotShapeItem
{
public:
MatrixShapeItem( const QString& title = QString() )
: QwtPlotShapeItem( title )
{
}
public:
double value;
size_t rowIndex;
size_t columnIndex;
};
class TextScaleDraw : public QwtScaleDraw
{
public:
TextScaleDraw( const std::map<size_t, QString>& tickLabels )
: m_tickLabels( tickLabels )
{
}
QwtText label( double value ) const override
{
size_t intValue = static_cast<size_t>( value + 0.25 );
auto it = m_tickLabels.find( intValue );
return it != m_tickLabels.end() ? it->second : "";
}
private:
std::map<size_t, QString> m_tickLabels;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMatrixPlotWidget::RiuMatrixPlotWidget( RimViewWindow* ownerViewWindow, RimRegularLegendConfig* legendConfig, QWidget* parent )
: matrixCellSelected( this )
, m_ownerViewWindow( ownerViewWindow )
, m_legendConfig( legendConfig )
{
// Configure main layout
QHBoxLayout* mainLayout = new QHBoxLayout();
mainLayout->setContentsMargins( 15, 15, 15, 15 );
this->setLayout( mainLayout );
// White background
QPalette palette = this->palette();
palette.setColor( QPalette::Window, Qt::white );
this->setAutoFillBackground( true );
this->setPalette( palette );
// Add plot to main layout
m_plotWidget = new RiuQwtPlotWidget( nullptr, parent );
m_plotWidget->qwtPlot()->insertLegend( nullptr );
mainLayout->addWidget( m_plotWidget );
// Add legend to main layout
if ( m_legendConfig )
{
m_legendFrame = m_legendConfig->makeLegendFrame();
mainLayout->addWidget( m_legendFrame );
}
// Configure plot widget to be a matrix plot?
m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), false, false );
m_plotWidget->enableGridLines( RiuPlotAxis::defaultBottom(), false, false );
m_plotWidget->enableGridLines( RiuPlotAxis::defaultRight(), false, false );
m_plotWidget->enableGridLines( RiuPlotAxis::defaultLeft(), false, false );
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMatrixPlotWidget::~RiuMatrixPlotWidget()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlot* RiuMatrixPlotWidget::qwtPlot() const
{
return m_plotWidget->qwtPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::clearPlotData()
{
m_columnHeaders = {};
m_rowHeaders = {};
m_rowValues = {};
m_plotWidget->qwtPlot()->detachItems();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setColumnHeaders( const std::vector<QString>& columnHeaders )
{
if ( m_columnHeaders.empty() )
{
m_columnHeaders = columnHeaders;
}
else if ( columnHeaders.size() == m_columnHeaders.size() )
{
m_columnHeaders = columnHeaders;
}
CAF_ASSERT( "Column headers must be assigned for an empty matrix or re-assigned with an equal number of columns!" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setRowValues( const QString& rowLabel, const std::vector<double>& values )
{
CAF_ASSERT( !m_columnHeaders.empty() && "Matrix column headers are not configured - headers are empty!" );
CAF_ASSERT( values.size() == m_columnHeaders.size() && "Number of row values must be equal number of configured matrix columns" );
// Insert in front to get rows from bottom to top in plot
m_rowHeaders.insert( m_rowHeaders.begin(), rowLabel );
m_rowValues.insert( m_rowValues.begin(), values );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::createPlot()
{
updateAxes();
createMatrixCells();
scheduleReplot();
auto scalarMapperFrame = dynamic_cast<RiuScalarMapperLegendFrame*>( m_legendFrame.data() );
auto categoryFrame = dynamic_cast<RiuCategoryLegendFrame*>( m_legendFrame.data() );
if ( scalarMapperFrame )
{
scalarMapperFrame->setScalarMapper( m_legendConfig->scalarMapper() );
scalarMapperFrame->updateTickValues();
scalarMapperFrame->update();
}
if ( categoryFrame )
{
categoryFrame->update();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::scheduleReplot()
{
m_plotWidget->scheduleReplot();
}
RimViewWindow* RiuMatrixPlotWidget::ownerViewWindow() const
{
return m_ownerViewWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::contextMenuEvent( QContextMenuEvent* )
{
// Added empty override to preventing menu for Mdi Area
// I.e.: RiuContextMenuLauncher for RiuPlotMainWindow (mdi area)
return;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setPlotTitleEnabled( bool enabled )
{
m_plotWidget->setPlotTitleEnabled( enabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setLegendFontSize( int fontSize )
{
m_plotWidget->setLegendFontSize( fontSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setPlotTitle( const QString& title )
{
m_plotWidget->setPlotTitle( title );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setShowValueLabel( bool showValueLabel )
{
m_showValueLabel = showValueLabel;
// Due to few data points - clear plot and create matrix cells with new label flag
m_plotWidget->qwtPlot()->detachItems();
createMatrixCells();
m_plotWidget->scheduleReplot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setRowTitle( const QString& title )
{
m_rowTitle = title;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setInvalidValueColor( const cvf::Color3ub& color )
{
m_invalidValueColor = color;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setUseInvalidValueColor( bool useInvalidValueColor )
{
m_useInvalidValueColor = useInvalidValueColor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setInvalidValueRange( double min, double max )
{
CAF_ASSERT( min <= max && "Min must be less or equal to max!" );
m_invalidValueRange = std::make_pair( min, max );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setColumnTitle( const QString& title )
{
m_columnTitle = title;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setPlotTitleFontSize( int fontSize )
{
m_plotWidget->setPlotTitleFontSize( fontSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setAxisTitleFontSize( int fontSize )
{
m_axisTitleFontSize = fontSize;
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), m_axisTitleFontSize, m_axisLabelFontSize );
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), m_axisTitleFontSize, m_axisLabelFontSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setAxisLabelFontSize( int fontSize )
{
m_axisLabelFontSize = fontSize;
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), m_axisTitleFontSize, m_axisLabelFontSize );
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), m_axisTitleFontSize, m_axisLabelFontSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::setValueFontSize( int fontSize )
{
m_valueFontSize = fontSize;
// Due to few data points - clear plot and create matrix cells with new font size
m_plotWidget->qwtPlot()->detachItems();
createMatrixCells();
m_plotWidget->scheduleReplot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::updateAxes()
{
if ( !m_plotWidget ) return;
// Labels on y-axis
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::YLeft, new TextScaleDraw( createIndexLabelMap( m_rowHeaders ) ) );
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new RiuQwtLinearScaleEngine );
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), m_rowTitle );
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), m_axisTitleFontSize, m_axisLabelFontSize, false, Qt::AlignCenter );
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), true, false );
m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), 0.0, static_cast<double>( m_rowHeaders.size() ) + 1 );
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis::defaultLeft(),
1.0,
0.0,
0.5,
static_cast<double>( m_rowHeaders.size() ) - 0.5,
0.0,
static_cast<double>( m_rowHeaders.size() ) );
// Labels on column axis
auto scaleDraw = new TextScaleDraw( createIndexLabelMap( m_columnHeaders ) );
scaleDraw->setLabelRotation( 30.0 );
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::XBottom, scaleDraw );
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new RiuQwtLinearScaleEngine );
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), m_columnTitle );
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(),
m_axisTitleFontSize,
m_axisLabelFontSize,
false,
Qt::AlignCenter | Qt::AlignTop );
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultBottom(), true, false );
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), 0.0, static_cast<double>( m_columnHeaders.size() ) + 1 );
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis::defaultBottom(),
1.0,
0.0,
0.5,
static_cast<double>( m_columnHeaders.size() ) - 0.5,
0.0,
static_cast<double>( m_columnHeaders.size() ) );
m_plotWidget->qwtPlot()->setAxisLabelAlignment( QwtAxis::XBottom, Qt::AlignRight );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::createMatrixCells()
{
CAF_ASSERT( m_legendConfig.notNull() && m_legendConfig->scalarMapper() && "Scalar mapper must be set for legend config!" );
for ( size_t rowIdx = 0u; rowIdx < m_rowValues.size(); ++rowIdx )
{
for ( size_t colIdx = 0u; colIdx < m_rowValues[rowIdx].size(); ++colIdx )
{
const double value = m_rowValues[rowIdx][colIdx];
const auto label = QString( "%1" ).arg( value, 0, 'f', 2 );
cvf::Color3ub color = m_legendConfig->scalarMapper()->mapToColor( value );
if ( m_useInvalidValueColor && m_invalidValueRange.first <= value && value <= m_invalidValueRange.second )
{
color = m_invalidValueColor;
}
QColor qColor( color.r(), color.g(), color.b() );
auto rectangle = RiuQwtPlotTools::createBoxShapeT<MatrixShapeItem>( label,
static_cast<double>( colIdx ),
static_cast<double>( colIdx ) + 1.0,
static_cast<double>( rowIdx ),
static_cast<double>( rowIdx ) + 1,
qColor );
rectangle->value = value;
rectangle->rowIndex = rowIdx;
rectangle->columnIndex = colIdx;
rectangle->attach( m_plotWidget->qwtPlot() );
if ( m_showValueLabel )
{
QwtText textLabel( label );
cvf::Color3f contrastColor = RiaColorTools::contrastColor( cvf::Color3f( color ) );
textLabel.setColor( RiaColorTools::toQColor( contrastColor ) );
QFont font = textLabel.font();
font.setPixelSize( caf::FontTools::pointSizeToPixelSize( m_valueFontSize ) );
textLabel.setFont( font );
QwtPlotMarker* marker = new QwtPlotMarker();
marker->setLabel( textLabel );
marker->setXValue( colIdx + 0.5 );
marker->setYValue( rowIdx + 0.5 );
marker->attach( m_plotWidget->qwtPlot() );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<size_t, QString> RiuMatrixPlotWidget::createIndexLabelMap( const std::vector<QString>& labels )
{
std::map<size_t, QString> indexLabelMap;
for ( size_t i = 0; i < labels.size(); ++i )
{
indexLabelMap.emplace( i, labels[i] );
}
return indexLabelMap;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMatrixPlotWidget::onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem, bool toggle, int sampleIndex )
{
RiuQwtPlotItem* qwtPlotItem = dynamic_cast<RiuQwtPlotItem*>( plotItem.get() );
if ( !qwtPlotItem ) return;
MatrixShapeItem* matrixItem = dynamic_cast<MatrixShapeItem*>( qwtPlotItem->qwtPlotItem() );
if ( matrixItem )
{
matrixCellSelected.send( std::make_pair( static_cast<int>( matrixItem->rowIndex ), static_cast<int>( matrixItem->columnIndex ) ) );
}
}

View File

@@ -0,0 +1,113 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiuInterfaceToViewWindow.h"
#include "RiuPlotItem.h"
#include "RiuQwtPlotWidget.h"
#include "cafFontTools.h"
#include "cafPdmPointer.h"
#include "cafSignal.h"
#include "cvfScalarMapper.h"
#include "qwt_plot.h"
#include <QPointer>
#include <QWidget>
class RimViewWindow;
class RimRegularLegendConfig;
class RiuAbstractLegendFrame;
class RiuMatrixPlotWidget : public QWidget, public RiuInterfaceToViewWindow, public caf::SignalEmitter
{
Q_OBJECT
public:
caf::Signal<std::pair<int, int>> matrixCellSelected;
public:
RiuMatrixPlotWidget( RimViewWindow* ownerViewWindow, RimRegularLegendConfig* legendConfig, QWidget* parent = nullptr );
~RiuMatrixPlotWidget() override;
QwtPlot* qwtPlot() const;
void createPlot();
void clearPlotData();
void setColumnHeaders( const std::vector<QString>& columnHeaders );
void setRowValues( const QString& rowLabel, const std::vector<double>& values );
void setPlotTitle( const QString& title );
void setColumnTitle( const QString& title );
void setRowTitle( const QString& title );
void setInvalidValueColor( const cvf::Color3ub& color );
void setUseInvalidValueColor( bool useInvalidValueColor );
void setInvalidValueRange( double min, double max );
void setShowValueLabel( bool showValueLabel );
void setPlotTitleFontSize( int fontSize );
void setPlotTitleEnabled( bool enabled );
void setLegendFontSize( int fontSize );
void setAxisTitleFontSize( int fontSize );
void setAxisLabelFontSize( int fontSize );
void setValueFontSize( int fontSize );
void scheduleReplot();
RimViewWindow* ownerViewWindow() const override;
protected:
void contextMenuEvent( QContextMenuEvent* ) override;
private slots:
void onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem, bool toggle, int sampleIndex );
private:
void updateAxes();
void createMatrixCells();
std::map<size_t, QString> createIndexLabelMap( const std::vector<QString>& labels );
private:
QPointer<RiuQwtPlotWidget> m_plotWidget;
QPointer<RiuAbstractLegendFrame> m_legendFrame;
caf::PdmPointer<RimViewWindow> m_ownerViewWindow; // Only intended to be used by ownerViewWindow()
caf::PdmPointer<RimRegularLegendConfig> m_legendConfig;
std::vector<QString> m_columnHeaders;
std::vector<QString> m_rowHeaders;
std::vector<std::vector<double>> m_rowValues;
cvf::Color3ub m_invalidValueColor = cvf::Color3ub::WHITE;
bool m_useInvalidValueColor = false;
std::pair<double, double> m_invalidValueRange = { 0.0, 0.0 };
bool m_showValueLabel = true;
QString m_rowTitle;
QString m_columnTitle;
int m_axisTitleFontSize = 8;
int m_axisLabelFontSize = 8;
int m_valueFontSize = 8;
};

View File

@@ -71,13 +71,15 @@ std::list<QMdiSubWindow*> RiuMdiArea::subWindowListSortedByPosition()
// Sort of list so we first sort by window position but retain activation order
// for windows with the same position
windowList.sort( [this]( QMdiSubWindow* lhs, QMdiSubWindow* rhs ) {
if ( lhs->frameGeometry().topLeft().rx() == rhs->frameGeometry().topLeft().rx() )
windowList.sort(
[]( QMdiSubWindow* lhs, QMdiSubWindow* rhs )
{
return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry();
}
return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx();
} );
if ( lhs->frameGeometry().topLeft().rx() == rhs->frameGeometry().topLeft().rx() )
{
return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry();
}
return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx();
} );
return windowList;
}
@@ -92,13 +94,15 @@ std::list<QMdiSubWindow*> RiuMdiArea::subWindowListSortedByVerticalPosition()
windowList.push_back( subWindow );
}
windowList.sort( [this]( QMdiSubWindow* lhs, QMdiSubWindow* rhs ) {
if ( lhs->frameGeometry().topLeft().ry() == rhs->frameGeometry().topLeft().ry() )
windowList.sort(
[]( QMdiSubWindow* lhs, QMdiSubWindow* rhs )
{
return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx();
}
return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry();
} );
if ( lhs->frameGeometry().topLeft().ry() == rhs->frameGeometry().topLeft().ry() )
{
return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx();
}
return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry();
} );
return windowList;
}

View File

@@ -0,0 +1,184 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuMenuBarBuildTools.h"
#include "cafCmdFeatureManager.h"
#include "cvfAssert.h"
#include "RiuToolTipMenu.h"
#include "RiuTools.h"
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QMenu* RiuMenuBarBuildTools::createDefaultFileMenu( QMenuBar* menuBar )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT( menuBar && cmdFeatureMgr );
QMenu* fileMenu = new RiuToolTipMenu( menuBar );
fileMenu->setTitle( "&File" );
menuBar->addMenu( fileMenu );
fileMenu->addAction( cmdFeatureMgr->action( "RicOpenProjectFeature" ) );
fileMenu->addAction( cmdFeatureMgr->action( "RicOpenLastUsedFileFeature" ) );
return fileMenu;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QMenu* RiuMenuBarBuildTools::createDefaultEditMenu( QMenuBar* menuBar )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT( menuBar && cmdFeatureMgr );
QMenu* editMenu = menuBar->addMenu( "&Edit" );
editMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToClipboardFeature" ) );
editMenu->addSeparator();
editMenu->addAction( cmdFeatureMgr->action( "RicShowMemoryCleanupDialogFeature" ) );
editMenu->addSeparator();
editMenu->addAction( cmdFeatureMgr->action( "RicEditPreferencesFeature" ) );
return editMenu;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QMenu* RiuMenuBarBuildTools::createDefaultViewMenu( QMenuBar* menuBar )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT( menuBar && cmdFeatureMgr );
QMenu* viewMenu = menuBar->addMenu( "&View" );
viewMenu->addAction( cmdFeatureMgr->action( "RicViewZoomAllFeature" ) );
return viewMenu;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QMenu* RiuMenuBarBuildTools::createDefaultHelpMenu( QMenuBar* menuBar )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT( menuBar && cmdFeatureMgr );
QMenu* helpMenu = menuBar->addMenu( "&Help" );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpAboutFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpCommandLineFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpSummaryCommandLineFeature" ) );
helpMenu->addSeparator();
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchIssuesHelpFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicCreateNewIssueHelpFeature" ) );
return helpMenu;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMenuBarBuildTools::addImportMenuWithActions( QObject* parent, QMenu* menu )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
if ( !parent || !menu || !cmdFeatureMgr ) return;
QMenu* importMenu = menu->addMenu( "&Import" );
QMenu* importEclipseMenu = importMenu->addMenu( QIcon( ":/Case48x48.png" ), "Eclipse Cases" );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCaseFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCasesFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCaseTimeStepFilterFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportInputEclipseCaseFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicCreateGridCaseGroupFromFilesFeature" ) );
QMenu* importRoffMenu = importMenu->addMenu( QIcon( ":/Case48x48.png" ), "Roff Grid Models" );
importRoffMenu->addAction( cmdFeatureMgr->action( "RicImportRoffCaseFeature" ) );
importMenu->addSeparator();
QMenu* importSummaryMenu = importMenu->addMenu( QIcon( ":/SummaryCase.svg" ), "Summary Cases" );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryCaseFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryCasesFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryGroupFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleFeature" ) );
#ifdef USE_ODB_API
importMenu->addSeparator();
QMenu* importGeoMechMenu = importMenu->addMenu( QIcon( ":/GeoMechCase24x24.png" ), "Geo Mechanical Cases" );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseFeature" ) );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseTimeStepFilterFeature" ) );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportElementPropertyFeature" ) );
#endif
importMenu->addSeparator();
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportSsihubFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellLogsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathFormationsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportWellMeasurementsFeature" ) );
importMenu->addSeparator();
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportPressureDepthDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportFormationNamesFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportSurfacesFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportSeismicFeature" ) );
RiuTools::enableAllActionsOnShow( parent, importMenu );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMenuBarBuildTools::addSaveProjectActions( QMenu* menu )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
if ( !menu || !cmdFeatureMgr ) return;
menu->addAction( cmdFeatureMgr->action( "RicSaveProjectFeature" ) );
menu->addAction( cmdFeatureMgr->action( "RicSaveProjectAsFeature" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMenuBarBuildTools::addCloseAndExitActions( QMenu* menu )
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
if ( !menu || !cmdFeatureMgr ) return;
menu->addAction( cmdFeatureMgr->action( "RicCloseProjectFeature" ) );
menu->addSeparator();
menu->addAction( cmdFeatureMgr->action( "RicExitApplicationFeature" ) );
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
class QMenu;
class QMenuBar;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
namespace RiuMenuBarBuildTools
{
QMenu* createDefaultFileMenu( QMenuBar* menuBar );
QMenu* createDefaultEditMenu( QMenuBar* menuBar );
QMenu* createDefaultViewMenu( QMenuBar* menuBar );
QMenu* createDefaultHelpMenu( QMenuBar* menuBar );
void addImportMenuWithActions( QObject* parent, QMenu* menu );
void addSaveProjectActions( QMenu* menu );
void addCloseAndExitActions( QMenu* menu );
}; // namespace RiuMenuBarBuildTools

View File

@@ -399,7 +399,6 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event )
m_goToPageAfterUpdate = true;
QWidget::showEvent( event );
performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
if ( m_previewMode )
{
applyPagePreviewBookSize( width() );
@@ -538,6 +537,14 @@ void RiuMultiPlotBook::updatePageTitles()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::forcePerformUpdate()
{
performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -93,6 +93,11 @@ public:
void keepCurrentPageAfterUpdate();
// https://github.com/OPM/ResInsight/issues/10349
// This function is used to force an update of the plot book. It is intended to be used from RimMultiPlot::onLoadDataAndUpdate()
// The code used to be called from RiuMultiPlotBook::showEvent(), but this caused a crash when a dock widget was hidden and shown again.
void forcePerformUpdate();
protected:
void contextMenuEvent( QContextMenuEvent* ) override;

View File

@@ -31,6 +31,7 @@
#include "RimPlotWindow.h"
#include "RiuDraggableOverlayFrame.h"
#include "RiuGuiTheme.h"
#include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotObjectPicker.h"
@@ -168,9 +169,8 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index )
m_subTitles.insert( static_cast<int>( index ), subTitle );
// Remove legend overlays already attached to the plot widget
auto matcher = []( RiuDraggableOverlayFrame* p ) {
return dynamic_cast<RiuQwtLegendOverlayContentFrame*>( p->contentFrame() ) != nullptr;
};
auto matcher = []( RiuDraggableOverlayFrame* p )
{ return dynamic_cast<RiuQwtLegendOverlayContentFrame*>( p->contentFrame() ) != nullptr; };
plotWidget->clearOverlayFrames( matcher );
RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
@@ -1096,7 +1096,8 @@ std::pair<int, int> RiuMultiPlotPage::findAvailableRowAndColumn( int startRow, i
void RiuMultiPlotPage::applyLook()
{
QPalette newPalette( palette() );
newPalette.setColor( QPalette::Window, Qt::white );
auto backgroundColor = RiuGuiTheme::getColorByVariableName( "mainBackgroundColor" );
newPalette.setColor( QPalette::Window, backgroundColor );
setPalette( newPalette );
setAutoFillBackground( true );
@@ -1158,7 +1159,8 @@ void RiuMultiPlotPage::alignAxes()
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::alignAxis( QwtAxisId axis, int targetRowOrColumn, std::function<bool( int, int, int )> matchPosition )
{
auto rowAndColumnFromIdx = [this]( int idx ) {
auto rowAndColumnFromIdx = [this]( int idx )
{
auto hit = m_visibleIndexToPositionMapping.find( idx );
CAF_ASSERT( hit != m_visibleIndexToPositionMapping.end() );
return hit->second;

View File

@@ -38,7 +38,7 @@ public:
protected:
static QImage
createTriangleImage( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle, const QSize& size, const QPen& pen, const QColor& color );
createTriangleImage( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle, const QSize& size, const QPen& pen, const QColor& color );
static QImage createRectImage( const QSize& size, const QPen& pen, const QColor& color );
static QImage createStar1Image( const QSize& size, const QPen& pen, const QColor& color );
static QImage createStar2Image( const QSize& size, const QPen& pen, const QColor& color );

View File

@@ -52,6 +52,7 @@
#include "RiuDragDrop.h"
#include "RiuMdiArea.h"
#include "RiuMdiSubWindow.h"
#include "RiuMenuBarBuildTools.h"
#include "RiuMessagePanel.h"
#include "RiuMultiPlotPage.h"
#include "RiuToolTipMenu.h"
@@ -155,14 +156,14 @@ RiuPlotMainWindow* RiuPlotMainWindow::instance()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::onWellSelected( QString wellName )
void RiuPlotMainWindow::onWellSelected( const QString& wellName, int timeStep )
{
RiuPlotMainWindow* plotWnd = instance();
if ( !plotWnd ) return;
if ( !plotWnd->selection3DLinkEnabled() ) return;
RimMainPlotCollection::current()->updateSelectedWell( wellName );
RimMainPlotCollection::current()->updateSelectedWell( wellName, timeStep );
}
//--------------------------------------------------------------------------------------------------
@@ -293,65 +294,25 @@ void RiuPlotMainWindow::keyPressEvent( QKeyEvent* keyEvent )
void RiuPlotMainWindow::createMenus()
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT( cmdFeatureMgr );
// File menu
QMenu* fileMenu = new RiuToolTipMenu( menuBar() );
fileMenu->setTitle( "&File" );
menuBar()->addMenu( fileMenu );
fileMenu->addAction( cmdFeatureMgr->action( "RicOpenProjectFeature" ) );
fileMenu->addAction( cmdFeatureMgr->action( "RicOpenLastUsedFileFeature" ) );
QMenu* fileMenu = RiuMenuBarBuildTools::createDefaultFileMenu( menuBar() );
fileMenu->addSeparator();
QMenu* importMenu = fileMenu->addMenu( "&Import" );
QMenu* importEclipseMenu = importMenu->addMenu( QIcon( ":/Case24x24.png" ), "Eclipse Cases" );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCaseFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportEclipseCasesFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicImportInputEclipseCaseFeature" ) );
importEclipseMenu->addAction( cmdFeatureMgr->action( "RicCreateGridCaseGroupFromFilesFeature" ) );
#ifdef USE_ODB_API
importMenu->addSeparator();
QMenu* importGeoMechMenu = importMenu->addMenu( QIcon( ":/GeoMechCase24x24.png" ), "Geo Mechanical Cases" );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseFeature" ) );
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportElementPropertyFeature" ) );
#endif
importMenu->addSeparator();
QMenu* importSummaryMenu = importMenu->addMenu( QIcon( ":/SummaryCase.svg" ), "Summary Cases" );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryCaseFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryCasesFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryGroupFeature" ) );
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleFeature" ) );
importMenu->addSeparator();
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportSsihubFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellLogsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathFormationsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleWellLogsFeature" ) );
importMenu->addSeparator();
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportPressureDepthDataFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportFormationNamesFeature" ) );
RiuTools::enableAllActionsOnShow( this, importMenu );
// Import menu actions
RiuMenuBarBuildTools::addImportMenuWithActions( this, fileMenu );
// Export menu actions
QMenu* exportMenu = fileMenu->addMenu( "&Export" );
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToFileFeature" ) );
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToPdfFeature" ) );
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotAllPlotsToFileFeature" ) );
exportMenu->addAction( cmdFeatureMgr->action( "RicSaveEclipseInputActiveVisibleCellsFeature" ) );
// Save menu actions
fileMenu->addSeparator();
fileMenu->addAction( cmdFeatureMgr->action( "RicSaveProjectFeature" ) );
fileMenu->addAction( cmdFeatureMgr->action( "RicSaveProjectAsFeature" ) );
RiuMenuBarBuildTools::addSaveProjectActions( fileMenu );
std::vector<QAction*> recentFileActions = RiaGuiApplication::instance()->recentFileActions();
for ( auto act : recentFileActions )
@@ -359,47 +320,29 @@ void RiuPlotMainWindow::createMenus()
fileMenu->addAction( act );
}
// Close and Exit actions
fileMenu->addSeparator();
fileMenu->addAction( cmdFeatureMgr->action( "RicCloseProjectFeature" ) );
fileMenu->addSeparator();
fileMenu->addAction( cmdFeatureMgr->action( "RicExitApplicationFeature" ) );
RiuMenuBarBuildTools::addCloseAndExitActions( fileMenu );
// Edit menu
QMenu* editMenu = menuBar()->addMenu( "&Edit" );
editMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToClipboardFeature" ) );
editMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToFileFeature" ) );
editMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToPdfFeature" ) );
editMenu->addSeparator();
editMenu->addAction( cmdFeatureMgr->action( "RicEditPreferencesFeature" ) );
QMenu* editMenu = RiuMenuBarBuildTools::createDefaultEditMenu( menuBar() );
if ( RiaPreferences::current()->useUndoRedo() )
{
editMenu->addSeparator();
editMenu->addAction( m_undoAction );
editMenu->addAction( m_redoAction );
}
connect( editMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshUndoRedoActions() ) );
// View menu
QMenu* viewMenu = menuBar()->addMenu( "&View" );
viewMenu->addAction( cmdFeatureMgr->action( "RicViewZoomAllFeature" ) );
RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() );
// Windows menu
m_windowMenu = menuBar()->addMenu( "&Windows" );
connect( m_windowMenu, SIGNAL( aboutToShow() ), SLOT( slotBuildWindowActions() ) );
// Help menu
QMenu* helpMenu = menuBar()->addMenu( "&Help" );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpAboutFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpCommandLineFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpSummaryCommandLineFeature" ) );
helpMenu->addSeparator();
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchIssuesHelpFeature" ) );
helpMenu->addAction( cmdFeatureMgr->action( "RicCreateNewIssueHelpFeature" ) );
QMenu* helpMenu = RiuMenuBarBuildTools::createDefaultHelpMenu( menuBar() );
connect( helpMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshHelpActions() ) );
}
@@ -887,8 +830,7 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( uiItem );
if ( pdmObject )
{
std::vector<RimViewWindow*> ancestralViews;
pdmObject->allAncestorsOrThisOfType( ancestralViews );
std::vector<RimViewWindow*> ancestralViews = pdmObject->allAncestorsOrThisOfType<RimViewWindow>();
for ( auto ancestralView : ancestralViews )
{
if ( ancestralView == activatedView )
@@ -966,7 +908,7 @@ void RiuPlotMainWindow::selectedObjectsChanged()
RimViewWindow* selectedWindow = dynamic_cast<RimViewWindow*>( firstSelectedObject );
if ( !selectedWindow )
{
firstSelectedObject->firstAncestorOrThisOfType( selectedWindow );
selectedWindow = firstSelectedObject->firstAncestorOrThisOfType<RimViewWindow>();
}
// If we cant find the view window as an MDI sub window, we search higher in the
@@ -975,7 +917,7 @@ void RiuPlotMainWindow::selectedObjectsChanged()
{
if ( selectedWindow->parentField() && selectedWindow->parentField()->ownerObject() )
{
selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType( selectedWindow );
selectedWindow = selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType<RimViewWindow>();
}
}
@@ -992,14 +934,12 @@ void RiuPlotMainWindow::selectedObjectsChanged()
if ( firstSelectedObject )
{
RimSummaryMultiPlot* multiSummaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot );
auto multiSummaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryMultiPlot>();
if ( multiSummaryPlot )
{
updateMultiPlotToolBar();
RimSummaryPlot* summaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( summaryPlot );
auto summaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryPlot>();
if ( summaryPlot )
{
multiSummaryPlot->makeSureIsVisible( summaryPlot );

View File

@@ -60,7 +60,7 @@ public:
~RiuPlotMainWindow() override;
static RiuPlotMainWindow* instance();
static void onWellSelected( QString wellName );
static void onWellSelected( const QString& wellName, int timeStep );
QString mainWindowName() override;

View File

@@ -135,7 +135,7 @@ public:
void applyFontSizes( bool replot );
private:
void plotUiSelectedCurves();
void plotUiSelectedCurves();
static QString unitLabelFromCurveIdent( RiaDefines::EclipseUnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent );
private slots:

View File

@@ -18,7 +18,9 @@
#include "RiuPvtPlotUpdater.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"

View File

@@ -68,7 +68,8 @@ void QssSyntaxHighligter::highlightBlock( const QString& text )
setCurrentBlockState( -1 );
auto parseClass = [this, text]( int startIndex, int length ) {
auto parseClass = [this, text]( int startIndex, int length )
{
QTextCharFormat propertyFormat;
propertyFormat.setFontWeight( QFont::Bold );

View File

@@ -502,7 +502,8 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend )
bool showScatterMarker = isVisibleInLegend && m_symbol;
bool showLineMarker = isVisibleInLegend && !m_symbol;
auto setLegendVisibility = [this]( auto series, bool isVisible ) {
auto setLegendVisibility = [this]( auto series, bool isVisible )
{
if ( series )
{
auto markers = m_plotWidget->qtChart()->legend()->markers( series );

View File

@@ -307,7 +307,8 @@ void RiuQtChartsPlotWidget::setInternalLegendVisible( bool visible )
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::insertLegend( RiuPlotWidget::Legend legendPosition )
{
auto mapLegendPosition = []( RiuPlotWidget::Legend pos ) {
auto mapLegendPosition = []( RiuPlotWidget::Legend pos )
{
if ( pos == RiuPlotWidget::Legend::BOTTOM )
return Qt::AlignBottom;
else if ( pos == RiuPlotWidget::Legend::TOP )
@@ -860,7 +861,8 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve,
auto series,
auto xAxis,
auto yAxis,
RiuQtChartsPlotCurve* qtChartsPlotCurve ) {
RiuQtChartsPlotCurve* qtChartsPlotCurve )
{
if ( !series->chart() )
{
curveSeriesMap[plotCurve] = series;

View File

@@ -124,18 +124,18 @@ public:
void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) override;
virtual void setMajorTicksList( RiuPlotAxis axis, const QList<double>& majorTicks, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervals( RiuPlotAxis axis, double majorTickInterval, double minorTickInterval, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
double majorTickInterval,
double minorTickInterval,
double minTickValue,
double maxTickValue,
double rangeMin,
double rangeMax ) override;
void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override;
double majorTickInterval( RiuPlotAxis axis ) const override;
double minorTickInterval( RiuPlotAxis axis ) const override;
void setMajorTicksList( RiuPlotAxis axis, const QList<double>& majorTicks, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervals( RiuPlotAxis axis, double majorTickInterval, double minorTickInterval, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
double majorTickInterval,
double minorTickInterval,
double minTickValue,
double maxTickValue,
double rangeMin,
double rangeMax ) override;
void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override;
double majorTickInterval( RiuPlotAxis axis ) const override;
double minorTickInterval( RiuPlotAxis axis ) const override;
void detachItems( RiuPlotWidget::PlotItemType plotItemType ) override;

View File

@@ -176,7 +176,7 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPosition
{
const QwtScaleDraw* mainAxisScaleDraw = m_isMainAxisHorizontal ? m_plot->axisScaleDraw( *relatedXAxis )
: m_plot->axisScaleDraw( *relatedYAxis );
auto dateScaleDraw = dynamic_cast<const QwtDateScaleDraw*>( mainAxisScaleDraw );
auto dateScaleDraw = dynamic_cast<const QwtDateScaleDraw*>( mainAxisScaleDraw );
qreal mainAxisSampleVal = 0.0;
if ( m_isMainAxisHorizontal )

View File

@@ -78,6 +78,7 @@
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent )
: RiuPlotWidget( plotDefinition, parent )
, m_titleRenderingFlags( Qt::AlignHCenter | Qt::TextSingleLine )
{
auto* layout = new QVBoxLayout;
layout->setContentsMargins( 0, 0, 0, 0 );
@@ -94,15 +95,18 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent )
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
connect( this, SIGNAL( plotSelected( bool ) ), plotDefinition, SLOT( onPlotSelected( bool ) ) );
connect( this, SIGNAL( axisSelected( RiuPlotAxis, bool ) ), plotDefinition, SLOT( onAxisSelected( RiuPlotAxis, bool ) ) );
connect( this,
SIGNAL( plotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ),
plotDefinition,
SLOT( onPlotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ) );
connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) );
connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) );
connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) );
if ( plotDefinition )
{
connect( this, SIGNAL( plotSelected( bool ) ), plotDefinition, SLOT( onPlotSelected( bool ) ) );
connect( this, SIGNAL( axisSelected( RiuPlotAxis, bool ) ), plotDefinition, SLOT( onAxisSelected( RiuPlotAxis, bool ) ) );
connect( this,
SIGNAL( plotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ),
plotDefinition,
SLOT( onPlotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ) );
connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) );
connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) );
connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) );
}
ensureAxisIsCreated( RiuPlotAxis::defaultLeft() );
ensureAxisIsCreated( RiuPlotAxis::defaultBottom() );
@@ -245,9 +249,18 @@ void RiuQwtPlotWidget::setPlotTitleFontSize( int titleFontSize )
QFont font = title.font();
font.setPixelSize( caf::FontTools::pointSizeToPixelSize( titleFontSize ) );
title.setFont( font );
title.setRenderFlags( title.renderFlags() | Qt::TextWordWrap );
m_plot->setTitle( title );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::setPlotTitleRenderingFlags( int flags )
{
m_titleRenderingFlags = flags;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -665,7 +678,7 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt()
{
QString plotTitleToApply = m_plotTitleEnabled ? m_plotTitle : QString( "" );
QwtText plotTitle = m_plot->title();
plotTitle.setRenderFlags( Qt::AlignHCenter | Qt::TextSingleLine );
plotTitle.setRenderFlags( m_titleRenderingFlags );
if ( plotTitleToApply != plotTitle.text() )
{
plotTitle.setText( plotTitleToApply );
@@ -996,6 +1009,12 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::set<const QwtPlotItem*>&
auto plotItemList = m_plot->itemList();
for ( QwtPlotItem* plotItem : plotItemList )
{
auto* riuPlotCurve = dynamic_cast<RiuPlotCurve*>( plotItem );
auto pdmObject = m_plotDefinition->findPdmObjectFromPlotCurve( riuPlotCurve );
// Do not modify curve objects with no associated Rim object, as the Rim object is used to restore color after highlight manipulation
if ( !pdmObject ) continue;
auto* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
if ( plotCurve )
{
@@ -1017,6 +1036,13 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::set<const QwtPlotItem*>&
double zValue = plotCurve->z();
if ( closestItems.count( plotCurve ) > 0 )
{
auto saturation = 1.0;
auto value = 1.0;
auto hue = curveColor.hueF();
auto highlightColor = QColor::fromHsvF( hue, saturation, value );
existingPen.setColor( highlightColor );
existingPen.setWidth( penWidth + highlightItemWidthAdjustment() );
plotCurve->setPen( existingPen );
plotCurve->setZ( zValue + 100.0 );
@@ -1024,9 +1050,10 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::set<const QwtPlotItem*>&
}
else
{
QColor blendedColor = RiaColorTools::blendQColors( bgColor, curveColor, 3, 1 );
QColor blendedSymbolColor = RiaColorTools::blendQColors( bgColor, symbolColor, 3, 1 );
QColor blendedSymbolLineColor = RiaColorTools::blendQColors( bgColor, symbolLineColor, 3, 1 );
int backgroundWeight = 2;
QColor blendedColor = RiaColorTools::blendQColors( bgColor, curveColor, backgroundWeight, 1 );
QColor blendedSymbolColor = RiaColorTools::blendQColors( bgColor, symbolColor, backgroundWeight, 1 );
QColor blendedSymbolLineColor = RiaColorTools::blendQColors( bgColor, symbolLineColor, backgroundWeight, 1 );
plotCurve->setPen( blendedColor, existingPen.width(), existingPen.style() );
if ( symbol )
@@ -1139,8 +1166,8 @@ void RiuQwtPlotWidget::resetPlotAxisHighlighting()
QwtAxis::Position::XBottom };
// Use text color from theme
QColor textColor = RiuGuiTheme::getColorByVariableName( "text-color" );
QString style = QString( "color: rgb(%1, %2, %3);" ).arg( textColor.red() ).arg( textColor.green() ).arg( textColor.blue() );
QColor textColor = RiuGuiTheme::getColorByVariableName( "textColor" );
QString style = QString( "color: %1;" ).arg( textColor.name() );
for ( auto pos : axisPositions )
{
@@ -1199,7 +1226,11 @@ void RiuQwtPlotWidget::highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY )
if ( axisId != axisIdX && axisId != axisIdY )
{
auto axisWidget = m_plot->axisWidget( axisId );
axisWidget->setStyleSheet( "color: #D9D9D9" );
auto color = RiuGuiTheme::getColorByVariableName( "backgroundColor2" );
auto colorText = color.name();
axisWidget->setStyleSheet( QString( "color: %1;" ).arg( colorText ) );
}
}
}
@@ -1450,7 +1481,8 @@ void RiuQwtPlotWidget::onMouseMoveEvent( QMouseEvent* event )
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis )
{
auto countAxis = [this]( RiaDefines::PlotAxis axis ) {
auto countAxis = [this]( RiaDefines::PlotAxis axis )
{
int count = 0;
for ( auto [plotAxis, qwtMapping] : m_axisMapping )
{
@@ -1459,12 +1491,14 @@ void RiuQwtPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis )
return count;
};
auto isLastItem = [this]( RiuPlotAxis plotAxis, int count ) {
auto isLastItem = [this]( RiuPlotAxis plotAxis, int count )
{
auto qwtAxis = toQwtPlotAxis( plotAxis );
return qwtAxis.id == ( count - 1 );
};
auto removeAxis = [this, countAxis, isLastItem]( RiuPlotAxis plotAxis ) {
auto removeAxis = [this, countAxis, isLastItem]( RiuPlotAxis plotAxis )
{
auto qwtAxisPos = RiuQwtPlotTools::toQwtPlotAxisEnum( plotAxis.axis() );
int count = countAxis( plotAxis.axis() );

View File

@@ -101,6 +101,7 @@ public:
void setPlotTitleEnabled( bool enabled ) override;
bool plotTitleEnabled() const override;
void setPlotTitleFontSize( int titleFontSize ) override;
void setPlotTitleRenderingFlags( int flags );
void setLegendFontSize( int fontSize ) override;
void setInternalLegendVisible( bool visible ) override;
@@ -115,18 +116,18 @@ public:
void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) override;
virtual void setMajorTicksList( RiuPlotAxis axis, const QList<double>& majorTicks, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervals( RiuPlotAxis axis, double majorTickInterval, double minorTickInterval, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
double majorTickInterval,
double minorTickInterval,
double minTickValue,
double maxTickValue,
double rangeMin,
double rangeMax ) override;
void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override;
double majorTickInterval( RiuPlotAxis axis ) const override;
double minorTickInterval( RiuPlotAxis axis ) const override;
void setMajorTicksList( RiuPlotAxis axis, const QList<double>& majorTicks, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervals( RiuPlotAxis axis, double majorTickInterval, double minorTickInterval, double minValue, double maxValue ) override;
void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
double majorTickInterval,
double minorTickInterval,
double minTickValue,
double maxTickValue,
double rangeMin,
double rangeMax ) override;
void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override;
double majorTickInterval( RiuPlotAxis axis ) const override;
double minorTickInterval( RiuPlotAxis axis ) const override;
int axisExtent( RiuPlotAxis axis ) const override;
@@ -234,4 +235,6 @@ private:
std::map<RiuPlotAxis, QwtAxisId> m_axisMapping;
QPointer<QwtPlot> m_plot;
int m_titleRenderingFlags;
};

View File

@@ -23,6 +23,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigGridBase.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
@@ -34,7 +35,7 @@
#include "RimEclipseView.h"
#include "RimExtrudedCurveIntersection.h"
//#include "cvfTrace.h"
// #include "cvfTrace.h"
#include <cmath>

View File

@@ -22,12 +22,14 @@
#include "RigAllanDiagramData.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RigSimWellData.h"
#include "RigWellResultFrame.h"
#include "RigWellResultPoint.h"
#include "Rim2dIntersectionView.h"
@@ -286,8 +288,7 @@ QString RiuResultTextBuilder::coordinatesText( const RigGridBase* grid, size_t g
if ( m_eclipseView )
{
std::vector<RimMultipleEclipseResults*> additionalResultSettings;
m_eclipseView->descendantsOfType( additionalResultSettings );
std::vector<RimMultipleEclipseResults*> additionalResultSettings = m_eclipseView->descendantsOfType<RimMultipleEclipseResults>();
if ( !additionalResultSettings.empty() )
{
showCenter = additionalResultSettings[0]->showCenterCoordinates();
@@ -1119,8 +1120,7 @@ std::map<QString, QString> RiuResultTextBuilder::cellResultTextAndValueText( Rim
}
else
{
RimIntersectionResultDefinition* interResDef = nullptr;
eclResDef->firstAncestorOrThisOfType( interResDef );
auto interResDef = eclResDef->firstAncestorOrThisOfType<RimIntersectionResultDefinition>();
if ( interResDef )
{
legendConfig = interResDef->regularLegendConfig();
@@ -1168,13 +1168,13 @@ QString RiuResultTextBuilder::wellResultText()
continue;
}
const RigWellResultPoint* wellResultCell = wellResultFrame->findResultCellWellHeadIncluded( m_gridIndex, m_cellIndex );
if ( wellResultCell )
const RigWellResultPoint wellResultCell = wellResultFrame->findResultCellWellHeadIncluded( m_gridIndex, m_cellIndex );
if ( wellResultCell.isValid() )
{
const int branchId = wellResultCell->branchId();
const int segmentId = wellResultCell->segmentId();
const int outletBranchId = wellResultCell->outletBranchId();
const int outletSegmentId = wellResultCell->outletSegmentId();
const int branchId = wellResultCell.branchId();
const int segmentId = wellResultCell.segmentId();
const int outletBranchId = wellResultCell.outletBranchId();
const int outletSegmentId = wellResultCell.outletSegmentId();
text += QString( "-- Well-cell connection info --\n Well Name: %1\n Branch Id: %2\n Segment "
"Id: %3\n Outlet Branch Id: %4\n Outlet Segment Id: %5\n" )

View File

@@ -39,10 +39,7 @@ RiuScalarMapperLegendFrame::RiuScalarMapperLegendFrame( QWidget* parent, const Q
, m_tickNumberPrecision( 4 )
, m_numberFormat( RiaNumberFormat::NumberFormatType::AUTO )
{
if ( m_scalarMapper.notNull() )
{
m_scalarMapper->majorTickValues( &m_tickValues );
}
updateTickValues();
}
//--------------------------------------------------------------------------------------------------
@@ -68,6 +65,26 @@ void RiuScalarMapperLegendFrame::setTickFormat( NumberFormat format )
m_numberFormat = format;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuScalarMapperLegendFrame::updateTickValues()
{
if ( m_scalarMapper.notNull() )
{
m_tickValues = {};
m_scalarMapper->majorTickValues( &m_tickValues );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuScalarMapperLegendFrame::setScalarMapper( cvf::ScalarMapper* scalarMapper )
{
m_scalarMapper = scalarMapper;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -46,6 +46,8 @@ public:
void setTickPrecision( int precision );
void setTickFormat( NumberFormat format );
void updateTickValues();
void setScalarMapper( cvf::ScalarMapper* scalarMapper );
private:
void layoutInfo( LayoutInfo* layout ) const override;

View File

@@ -0,0 +1,174 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuSeismicHistogramPanel.h"
#include "Riu3dSelectionManager.h"
#include "RiuDockedQwtPlot.h"
#include "RiuGuiTheme.h"
#include "RiuPlotCurveSymbol.h"
#include "RiuQwtLinearScaleEngine.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtSymbol.h"
#include "qwt_plot_grid.h"
#include "qwt_text.h"
#include "RimRegularLegendConfig.h"
#include "RimSeismicDataInterface.h"
#include "RimSeismicSection.h"
#include <QFont>
#include <QHBoxLayout>
#include <QLabel>
#include <QPen>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSeismicHistogramPanel::RiuSeismicHistogramPanel( QWidget* parent )
: QWidget( parent )
{
m_qwtPlot = new RiuDockedQwtPlot( this );
QwtPlotGrid* grid = new QwtPlotGrid;
grid->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( grid );
QVBoxLayout* mainLayout = new QVBoxLayout();
mainLayout->addWidget( m_qwtPlot );
mainLayout->setContentsMargins( 0, 0, 0, 0 );
setLayout( mainLayout );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSeismicHistogramPanel::~RiuSeismicHistogramPanel()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSeismicHistogramPanel::setPlotData( QString title, std::vector<double> xvals, std::vector<double> yvals )
{
m_qwtPlot->detachItems( QwtPlotItem::Rtti_PlotCurve );
RiuQwtPlotCurve* qwtCurve = new RiuQwtPlotCurve( nullptr, "Distribution" );
qwtCurve->setSamplesFromXValuesAndYValues( xvals, yvals, false );
qwtCurve->setStyle( QwtPlotCurve::Lines );
Qt::PenStyle penStyle = Qt::SolidLine;
QPen curvePen( QBrush(), 1, penStyle );
curvePen.setColor( QColor( 5, 5, 5, 255 ) );
qwtCurve->setPen( curvePen );
RiuQwtSymbol* curveSymbol = new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_NONE );
curveSymbol->setBrush( Qt::NoBrush );
qwtCurve->setSymbol( curveSymbol );
qwtCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
qwtCurve->setYAxis( RiuPlotAxis::defaultLeft() );
qwtCurve->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( qwtCurve );
m_qwtPlot->setAxisScaleEngine( QwtAxis::YLeft, new QwtLinearScaleEngine );
m_qwtPlot->setAxisScaleEngine( QwtAxis::XBottom, new QwtLinearScaleEngine );
m_qwtPlot->setAxisAutoScale( QwtAxis::XBottom, true );
m_qwtPlot->setAxisAutoScale( QwtAxis::YLeft, true );
m_qwtPlot->setAxisVisible( QwtAxis::YLeft, false );
QwtText plotTitle = m_qwtPlot->title();
QFont titleFont = plotTitle.font();
titleFont.setPointSize( 10 );
plotTitle.setText( title );
plotTitle.setFont( titleFont );
m_qwtPlot->setTitle( plotTitle );
m_qwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSeismicHistogramPanel::clearPlot()
{
m_qwtPlot->setTitle( "" );
m_qwtPlot->detachItems( QwtPlotItem::Rtti_PlotCurve );
m_qwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSeismicHistogramPanel::applyFontSizes( bool replot )
{
if ( m_qwtPlot ) m_qwtPlot->applyFontSizes( replot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSeismicHistogramPanel::showHistogram( caf::PdmObjectHandle* selectedObject )
{
RimSeismicDataInterface* seisData = dynamic_cast<RimSeismicDataInterface*>( selectedObject );
if ( seisData == nullptr )
{
RimSeismicSection* section = dynamic_cast<RimSeismicSection*>( selectedObject );
if ( section != nullptr )
{
seisData = section->seismicData();
}
}
if ( seisData == nullptr )
{
RimRegularLegendConfig* legend = dynamic_cast<RimRegularLegendConfig*>( selectedObject );
if ( legend )
{
auto section = legend->firstAncestorOfType<RimSeismicSection>();
if ( section != nullptr )
{
seisData = section->seismicData();
}
}
}
showHistogram( seisData );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSeismicHistogramPanel::showHistogram( RimSeismicDataInterface* seisData )
{
if ( seisData == nullptr )
{
clearPlot();
return;
}
setPlotData( QString::fromStdString( seisData->userDescription() ), seisData->histogramXvalues(), seisData->histogramYvalues() );
}

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QPointer>
#include <QWidget>
#include "cafPdmObject.h"
#include <vector>
class RiuDockedQwtPlot;
class RiuSelectionItem;
class RimSeismicDataInterface;
//==================================================================================================
//
//
//
//==================================================================================================
class RiuSeismicHistogramPanel : public QWidget
{
Q_OBJECT
public:
RiuSeismicHistogramPanel( QWidget* parent );
~RiuSeismicHistogramPanel() override;
void setPlotData( QString title, std::vector<double> xvals, std::vector<double> yvals );
void clearPlot();
void applyFontSizes( bool replot );
void showHistogram( caf::PdmObjectHandle* selectedObject );
void showHistogram( RimSeismicDataInterface* selectedObject );
private:
QPointer<RiuDockedQwtPlot> m_qwtPlot;
};

View File

@@ -19,6 +19,8 @@
#include "RiuSelectionChangedHandler.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigDepthResultAccessor.h"
#include "RigEclipseCaseData.h"
@@ -26,7 +28,6 @@
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "Rim2dIntersectionView.h"
#include "RimEclipseCase.h"
@@ -41,6 +42,7 @@
#include "Riu3dSelectionManager.h"
#include "RiuDepthQwtPlot.h"
#include "RiuFemResultTextBuilder.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "RiuMainWindow.h"
#include "RiuMohrsCirclePlot.h"
#include "RiuPvtPlotPanel.h"
@@ -49,6 +51,7 @@
#include "RiuRelativePermeabilityPlotUpdater.h"
#include "RiuResultQwtPlot.h"
#include "RiuResultTextBuilder.h"
#include "RiuSeismicHistogramPanel.h"
#include <QStatusBar>
@@ -446,14 +449,15 @@ void RiuSelectionChangedHandler::addDepthCurveFromSelectionItem( const RiuSelect
std::vector<double> resultValues = RigDepthResultAccessor::resultValues( casedata,
eclResDef,
eclipseSelectionItem->m_gridIndex,
static_cast<int>( eclipseSelectionItem->m_gridIndex ),
eclipseSelectionItem->m_gridLocalCellIndex,
currentTimeStep );
std::vector<int> kValues = RigDepthResultAccessor::kValues( casedata, eclipseSelectionItem->m_gridIndex );
std::vector<int> kValues = RigDepthResultAccessor::kValues( casedata, static_cast<int>( eclipseSelectionItem->m_gridIndex ) );
std::vector<double> depthValues =
RigDepthResultAccessor::depthValues( casedata, eclipseSelectionItem->m_gridLocalCellIndex, eclipseSelectionItem->m_gridIndex );
std::vector<double> depthValues = RigDepthResultAccessor::depthValues( casedata,
static_cast<int>( eclipseSelectionItem->m_gridLocalCellIndex ),
static_cast<int>( eclipseSelectionItem->m_gridIndex ) );
CVF_ASSERT( kValues.size() == resultValues.size() );

View File

@@ -88,8 +88,7 @@ void RiuSummaryPlot::showContextMenu( QPoint pos )
QString clickedQuantityName;
QStringList allQuantityNamesInPlot;
RimEnsembleCurveSet* clickedEnsembleCurveSet = nullptr;
summaryCurve->firstAncestorOrThisOfType( clickedEnsembleCurveSet );
auto clickedEnsembleCurveSet = summaryCurve->firstAncestorOrThisOfType<RimEnsembleCurveSet>();
bool curveClicked = distanceFromClick < 50;
@@ -124,9 +123,8 @@ void RiuSummaryPlot::showContextMenu( QPoint pos )
if ( !curveClicked )
{
auto* summaryPlot = static_cast<RimSummaryPlot*>( plotWidget()->plotDefinition() );
std::vector<RimEnsembleCurveSet*> allCurveSetsInPlot;
summaryPlot->descendantsOfType( allCurveSetsInPlot );
auto* summaryPlot = static_cast<RimSummaryPlot*>( plotWidget()->plotDefinition() );
std::vector<RimEnsembleCurveSet*> allCurveSetsInPlot = summaryPlot->descendantsOfType<RimEnsembleCurveSet>();
for ( auto curveSet : allCurveSetsInPlot )
{
allQuantityNamesInPlot.push_back( QString::fromStdString( curveSet->summaryAddress().uiText() ) );
@@ -167,10 +165,8 @@ void RiuSummaryPlot::showContextMenu( QPoint pos )
ensemble->parameterCorrelations( clickedEnsembleCurveSet->summaryAddress(), timeStep );
std::sort( ensembleParameters.begin(),
ensembleParameters.end(),
[]( const std::pair<RigEnsembleParameter, double>& lhs,
const std::pair<RigEnsembleParameter, double>& rhs ) {
return std::fabs( lhs.second ) > std::fabs( rhs.second );
} );
[]( const std::pair<RigEnsembleParameter, double>& lhs, const std::pair<RigEnsembleParameter, double>& rhs )
{ return std::fabs( lhs.second ) > std::fabs( rhs.second ); } );
for ( const auto& param : ensembleParameters )
{

View File

@@ -95,67 +95,67 @@ SummaryIdentifierAndField::~SummaryIdentifierAndField()
RiuSummaryVectorSelectionUi::RiuSummaryVectorSelectionUi()
: m_identifierFieldsMap( {
{ RifEclipseSummaryAddress::SUMMARY_FIELD,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_AQUIFER,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_AQUIFER_NUMBER ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_AQUIFER_NUMBER ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_NETWORK,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_MISC,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_REGION,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_REGION_NUMBER ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_REGION_NUMBER ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_REGION_2_REGION ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_REGION_2_REGION ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_GROUP,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_GROUP_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_GROUP_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_WELL,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_LGR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_LGR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_WELL_LGR,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_LGR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_LGR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_SEGMENT_NUMBER ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_WELL_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_SEGMENT_NUMBER ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_BLOCK,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_LGR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_LGR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_CELL_IJK ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
{ RifEclipseSummaryAddress::SUMMARY_IMPORTED,
{ { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } } },
{ new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ),
new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_ID ) } },
} )
, m_showIndividualEnsembleCases( true )
@@ -1398,7 +1398,7 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForCategories( QList<caf::Pdm
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_COMPLETION );
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_BLOCK );
if ( m_hideCalculationIncompatibleCategories )
if ( !m_hideCalculationIncompatibleCategories )
{
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_SEGMENT );
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_LGR );

View File

@@ -46,7 +46,7 @@ public:
~RiuTofAccumulatedPhaseFractionsPlot() override;
RiuTofAccumulatedPhaseFractionsPlot( const RiuTofAccumulatedPhaseFractionsPlot& ) = delete;
void operator=( const RiuTofAccumulatedPhaseFractionsPlot& o ) = delete;
void operator=( const RiuTofAccumulatedPhaseFractionsPlot& o ) = delete;
RimTofAccumulatedPhaseFractionsPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;

View File

@@ -39,9 +39,12 @@ void RiuTools::enableAllActionsOnShow( QObject* object, QMenu* menu )
{
if ( object && menu )
{
object->connect( menu, &QMenu::aboutToShow, [menu]() {
for ( auto act : menu->actions() )
act->setEnabled( true );
} );
object->connect( menu,
&QMenu::aboutToShow,
[menu]()
{
for ( auto act : menu->actions() )
act->setEnabled( true );
} );
}
}

View File

@@ -577,6 +577,14 @@ void RiuViewer::setInfoText( QString text )
m_infoLabel->setText( text );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuViewer::infoText() const
{
return m_infoLabel->text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -86,9 +86,10 @@ public:
RiuViewerToViewInterface* ownerReservoirView();
RimViewWindow* ownerViewWindow() const override;
void showInfoText( bool enable );
void showVersionInfo( bool enable );
void setInfoText( QString text );
void showInfoText( bool enable );
void showVersionInfo( bool enable );
void setInfoText( QString text );
QString infoText() const;
void hideZScaleCheckbox( bool hide );
void showZScaleLabel( bool enable );

View File

@@ -60,6 +60,7 @@
#include "RimLegendConfig.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimSeismicSection.h"
#include "RimSimWellInView.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimSurfaceInView.h"
@@ -82,6 +83,7 @@
#include "RivObjectSourceInfo.h"
#include "RivPartPriority.h"
#include "RivReservoirSurfaceIntersectionSourceInfo.h"
#include "RivSeismicSectionSourceInfo.h"
#include "RivSimWellConnectionSourceInfo.h"
#include "RivSimWellPipeSourceInfo.h"
#include "RivSourceInfo.h"
@@ -482,7 +484,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
// TODO: Update so these also use RiuWellPathSelectionItem
caf::SelectionManager::instance()->setSelectedItem( wellPath );
menuBuilder << "RicNewWellLogCurveExtractionFeature";
menuBuilder << "RicNewWellLogExtractionCurveFeature";
menuBuilder << "RicNewWellLogFileCurveFeature";
menuBuilder.addSeparator();
@@ -532,6 +534,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
menuBuilder << "RicNewWellPathLateralAtDepthFeature";
menuBuilder << "RicNewWellPathIntersectionFeature";
menuBuilder << "RicLinkWellPathFeature";
menuBuilder << "RicDuplicateWellPathFeature";
}
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>( firstHitPart->sourceInfo() );
@@ -547,7 +550,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
eclipseWellSourceInfo->branchIndex() );
Riu3dSelectionManager::instance()->setSelectedItem( selItem, Riu3dSelectionManager::RUI_TEMPORARY );
menuBuilder << "RicNewWellLogCurveExtractionFeature";
menuBuilder << "RicNewWellLogExtractionCurveFeature";
menuBuilder << "RicNewWellLogRftCurveFeature";
menuBuilder.addSeparator();
@@ -616,6 +619,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
#endif
menuBuilder << "RicShowGridStatisticsFeature";
menuBuilder << "RicSelectColorResult";
menuBuilder << "RicCopyGridStatisticsToClipboardFeature";
}
menuBuilder << "RicExportContourMapToTextFeature";
@@ -713,9 +717,10 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
if ( firstHitPart && firstHitPart->sourceInfo() )
{
// clang-format off
const RivObjectSourceInfo* rivObjectSourceInfo = dynamic_cast<const RivObjectSourceInfo*>( firstHitPart->sourceInfo() );
const RivObjectSourceInfo* rivObjectSourceInfo = dynamic_cast<const RivObjectSourceInfo*>( firstHitPart->sourceInfo() );
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>( firstHitPart->sourceInfo() );
const RivWellConnectionSourceInfo* wellConnectionSourceInfo = dynamic_cast<const RivWellConnectionSourceInfo*>( firstHitPart->sourceInfo() );
const RivSeismicSectionSourceInfo* seismicSourceInfo = dynamic_cast<const RivSeismicSectionSourceInfo*>(firstHitPart->sourceInfo());
// clang-format on
if ( rivObjectSourceInfo )
@@ -827,7 +832,8 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
{
bool allowActiveViewChange = dynamic_cast<Rim2dIntersectionView*>( m_viewer->ownerViewWindow() ) == nullptr;
RiuPlotMainWindow::onWellSelected( eclipseWellSourceInfo->well()->name() );
RiuPlotMainWindow::onWellSelected( eclipseWellSourceInfo->well()->name(), mainOrComparisonView->currentTimeStep() );
RiuMainWindow::instance()->selectAsCurrentItem( eclipseWellSourceInfo->well(), allowActiveViewChange );
}
else if ( wellConnectionSourceInfo )
@@ -839,9 +845,7 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( mainOrComparisonView );
if ( eclipseView )
{
RimEclipseCase* eclipseCase = nullptr;
eclipseView->firstAncestorOrThisOfTypeAsserted( eclipseCase );
auto eclipseCase = eclipseView->firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities() )
{
std::vector<RigCompletionData> completionsForOneCell;
@@ -911,9 +915,7 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( mainOrComparisonView );
if ( eclipseView )
{
RimEclipseCase* eclipseCase = nullptr;
eclipseView->firstAncestorOrThisOfTypeAsserted( eclipseCase );
auto eclipseCase = eclipseView->firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities() )
{
auto connectionFactors = eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities();
@@ -949,6 +951,30 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
}
RiuMainWindow::instance()->selectAsCurrentItem( simWellConnectionSourceInfo->simWellInView(), allowActiveViewChange );
}
else if ( seismicSourceInfo != nullptr )
{
auto section = seismicSourceInfo->section();
RiuMainWindow::instance()->selectAsCurrentItem( section );
cvf::ref<caf::DisplayCoordTransform> transForm = mainOrComparisonView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->transformToDomainCoord( globalIntersectionPoint );
// Set surface resultInfo text
QString resultInfoText = "Seismic Section: \"" + section->fullName() + "\"\n\n";
resultInfoText += section->resultInfoText( domainCoord, seismicSourceInfo->partIndex() );
// Set intersection point result text
QString pointText = QString( "Global point : [E: %1, N: %2, Depth: %3]" )
.arg( domainCoord.x(), 5, 'f', 2 )
.arg( domainCoord.y(), 5, 'f', 2 )
.arg( -domainCoord.z(), 5, 'f', 2 );
resultInfoText.append( pointText );
// Display result info text
RiuMainWindow::instance()->setResultInfo( resultInfoText );
}
}
}
}

View File

@@ -51,8 +51,7 @@
RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nullptr */ )
: RiuQwtPlotWidget( track, parent )
{
RimWellLogPlot* wlp = nullptr;
track->firstAncestorOfType( wlp );
auto wlp = track->firstAncestorOfType<RimWellLogPlot>();
bool isVertical = ( wlp && wlp->depthOrientation() == RiaDefines::Orientation::VERTICAL );
setAxisEnabled( QwtAxis::YLeft, true );
@@ -101,8 +100,7 @@ void RiuWellLogTrack::createAnnotationsInPlot( const std::vector<RimPlotAxisAnno
// Not required to update annotations in an invisible plot
if ( !plotDefinition()->showWindow() ) return;
RimDepthTrackPlot* depthTrackPlot = nullptr;
m_plotDefinition->firstAncestorOfType( depthTrackPlot );
auto depthTrackPlot = m_plotDefinition->firstAncestorOfType<RimDepthTrackPlot>();
if ( !depthTrackPlot ) return;
auto orientation = depthTrackPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL ? RiaDefines::Orientation::VERTICAL
@@ -125,8 +123,7 @@ void RiuWellLogTrack::onMouseMoveEvent( QMouseEvent* mouseEvent )
if ( !m_plotDefinition ) return;
if ( mouseEvent->type() != QMouseEvent::MouseMove ) return;
RimDepthTrackPlot* depthTrackPlot = nullptr;
m_plotDefinition->firstAncestorOfType( depthTrackPlot );
auto depthTrackPlot = m_plotDefinition->firstAncestorOfType<RimDepthTrackPlot>();
if ( !depthTrackPlot || !depthTrackPlot->isDepthMarkerLineEnabled() ) return;
auto plotwidget = dynamic_cast<RiuQwtPlotWidget*>( m_plotDefinition->plotWidget() );
@@ -188,9 +185,7 @@ QwtText RiuWellLogCurvePointTracker::trackerText( const QPoint& pos ) const
{
QString str;
RimWellLogPlot* wlp = nullptr;
m_wellLogTrack->firstAncestorOfType( wlp );
auto wlp = m_wellLogTrack->firstAncestorOfType<RimWellLogPlot>();
if ( wlp && wlp->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
{
str = QString( "%1\nDepth: %2" ).arg( depthAxisValueString ).arg( xAxisValueString );

View File

@@ -135,8 +135,8 @@ void RiuWellPathComponentPlotItem::calculateColumnOffsets( const RimWellPathComp
{
std::set<double> uniqueCasingDiameters;
std::vector<RimWellPathAttributeCollection*> attributeCollection;
m_wellPath->descendantsIncludingThisOfType( attributeCollection );
std::vector<RimWellPathAttributeCollection*> attributeCollection =
m_wellPath->descendantsIncludingThisOfType<RimWellPathAttributeCollection>();
for ( const RimWellPathAttribute* otherAttribute : attributeCollection.front()->attributes() )
{
if ( otherAttribute->componentType() == RiaDefines::WellPathComponentType::CASING )
@@ -152,10 +152,10 @@ void RiuWellPathComponentPlotItem::calculateColumnOffsets( const RimWellPathComp
const RimWellPathAttribute* myAttribute = dynamic_cast<const RimWellPathAttribute*>( component );
if ( myAttribute && myAttribute->componentType() == RiaDefines::WellPathComponentType::CASING )
{
int nNarrowerCasings =
std::count_if( uniqueCasingDiameters.begin(), uniqueCasingDiameters.end(), [myAttribute]( double otherCasingDiameter ) {
return otherCasingDiameter < myAttribute->diameterInInches();
} );
int nNarrowerCasings = std::count_if( uniqueCasingDiameters.begin(),
uniqueCasingDiameters.end(),
[myAttribute]( double otherCasingDiameter )
{ return otherCasingDiameter < myAttribute->diameterInInches(); } );
m_columnOffset = nNarrowerCasings * 0.25;
}