Merge dev and feature-#5019-separate-intersection-results branch

This commit is contained in:
Jacob Støren
2019-11-25 15:50:29 +01:00
140 changed files with 2100 additions and 1799 deletions

View File

@@ -51,7 +51,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuViewerCommands.h
${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RiuGridPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.h
@@ -139,7 +139,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuViewerCommands.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuGridPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.cpp
@@ -201,7 +201,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuViewerCommands.h
${CMAKE_CURRENT_LIST_DIR}/RiuTreeViewEventFilter.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RiuGridPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h
${CMAKE_CURRENT_LIST_DIR}/RiuRecentFileActionProvider.h

View File

@@ -27,10 +27,10 @@
#include "RimCaseCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"
#include "RimGridPlotWindow.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimPlotInterface.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCaseMainCollection.h"
@@ -163,7 +163,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
}
if ( dynamic_cast<RimEclipseCase*>( uiItem ) || dynamic_cast<RimWellLogCurve*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlotInterface*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlot*>( uiItem ) ||
dynamic_cast<RimSummaryCase*>( uiItem ) )
{
// TODO: Remember to handle reservoir holding the main grid
@@ -186,16 +186,16 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimGridPlotWindow*>( uiItem ) )
else if ( dynamic_cast<RimMultiPlotWindow*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlotInterface>::containsTypedObjects( m_dragItems ) )
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimPlotInterface*>( uiItem ) )
else if ( dynamic_cast<RimPlot*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlotInterface>::containsTypedObjects( m_dragItems ) )
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
{
itemflags |= Qt::ItemIsDropEnabled;
}
@@ -304,11 +304,11 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack, row );
}
RimGridPlotWindow* gridPlotWindow;
dropTarget->firstAncestorOrThisOfType( gridPlotWindow );
if ( gridPlotWindow )
RimMultiPlotWindow* multiPlot;
dropTarget->firstAncestorOrThisOfType( multiPlot );
if ( multiPlot )
{
return handleGridPlotWindowDrop( action, draggedObjects, gridPlotWindow, row );
return handleMultiPlotDrop( action, draggedObjects, multiPlot, row );
}
RimSummaryCaseCollection* summaryCaseCollection;
@@ -444,7 +444,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
{
RimWellLogPlot* wellLogPlot;
trackTarget->firstAncestorOrThisOfType( wellLogPlot );
return handleGridPlotWindowDrop( action, draggedObjects, wellLogPlot, insertAtPosition );
return handleMultiPlotDrop( action, draggedObjects, wellLogPlot, insertAtPosition );
}
}
@@ -454,27 +454,27 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuDragDrop::handleGridPlotWindowDrop( Qt::DropAction action,
caf::PdmObjectGroup& draggedObjects,
RimGridPlotWindow* gridPlotWindow,
int insertAtPosition )
bool RiuDragDrop::handleMultiPlotDrop( Qt::DropAction action,
caf::PdmObjectGroup& draggedObjects,
RimMultiPlotWindow* multiPlot,
int insertAtPosition )
{
std::vector<RimPlotInterface*> plots = RiuTypedPdmObjects<RimPlotInterface>::typedObjectsFromGroup( draggedObjects );
std::vector<RimPlot*> plots = RiuTypedPdmObjects<RimPlot>::typedObjectsFromGroup( draggedObjects );
if ( plots.size() > 0 )
{
if ( action == Qt::MoveAction )
{
RimPlotInterface* insertAfter = nullptr;
RimPlot* insertAfter = nullptr;
if ( insertAtPosition > 0 )
{
auto visibleTracks = gridPlotWindow->visiblePlots();
auto visibleTracks = multiPlot->visiblePlots();
if ( !visibleTracks.empty() )
{
int insertAfterPosition = std::min( insertAtPosition - 1, (int)visibleTracks.size() - 1 );
insertAfter = dynamic_cast<RimPlotInterface*>( visibleTracks[insertAfterPosition] );
insertAfter = dynamic_cast<RimPlot*>( visibleTracks[insertAfterPosition] );
}
}
gridPlotWindow->movePlotsToThis( plots, insertAfter );
multiPlot->movePlotsToThis( plots, insertAfter );
return true;
}
}

View File

@@ -29,7 +29,7 @@ namespace caf
class PdmObjectHandle;
}
class RimGridPlotWindow;
class RimMultiPlotWindow;
class RimIdenticalGridCaseGroup;
class RimSummaryCaseCollection;
class RimSummaryCaseMainCollection;
@@ -65,10 +65,10 @@ private:
caf::PdmObjectGroup& objectGroup,
RimWellLogTrack* wellLogPlotTrack,
int insertAtPosition );
bool handleGridPlotWindowDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,
RimGridPlotWindow* gridPlotWindow,
int insertAtPosition );
bool handleMultiPlotDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,
RimMultiPlotWindow* multiPlot,
int insertAtPosition );
bool handleWellLogPlotCurveDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,
RimWellLogCurve* wellLogPlotCurve );

View File

@@ -30,7 +30,7 @@
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimRegularLegendConfig.h"
#include "cafCmdFeatureMenuBuilder.h"
@@ -58,7 +58,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent /*= nullptr*/ )
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimPlot* plotDefinition, QWidget* parent /*= nullptr*/ )
: RiuQwtPlotWidget( plotDefinition, parent )
{
// LeftButton for the zooming

View File

@@ -29,7 +29,7 @@
class RimGridCrossPlotDataSet;
class RimPlotAxisProperties;
class RimPlotInterface;
class RimPlot;
class RiuCvfOverlayItemWidget;
class RiuDraggableOverlayFrame;
class RiuPlotAnnotationTool;
@@ -50,7 +50,7 @@ class RiuGridCrossQwtPlot : public RiuQwtPlotWidget, public RiuInterfaceToViewWi
Q_OBJECT;
public:
RiuGridCrossQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent = nullptr );
RiuGridCrossQwtPlot( RimPlot* plotDefinition, QWidget* parent = nullptr );
~RiuGridCrossQwtPlot();
RiuGridCrossQwtPlot( const RiuGridCrossQwtPlot& ) = delete;

View File

@@ -17,7 +17,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuGridPlotWindow.h"
#include "RiuMultiPlotWindow.h"
#include "RiaApplication.h"
#include "RiaPlotWindowRedrawScheduler.h"
@@ -26,7 +26,7 @@
#include "WellLogCommands/RicWellLogPlotTrackFeatureImpl.h"
#include "RimContextCommandBuilder.h"
#include "RimGridPlotWindow.h"
#include "RimMultiPlotWindow.h"
#include "RimWellLogTrack.h"
#include "RiuMainWindow.h"
@@ -57,7 +57,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget* parent )
RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent )
: QWidget( parent )
{
Q_ASSERT( plotDefinition );
@@ -100,7 +100,7 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops( true );
setAcceptDrops( m_plotDefinition->acceptDrops() );
RiaApplication* app = RiaApplication::instance();
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum( app->preferences()->defaultPlotFontSize() );
@@ -112,7 +112,12 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow* RiuGridPlotWindow::ownerPlotDefinition()
RiuMultiPlotWindow::~RiuMultiPlotWindow() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMultiPlotWindow* RiuMultiPlotWindow::ownerPlotDefinition()
{
return m_plotDefinition;
}
@@ -120,7 +125,7 @@ RimGridPlotWindow* RiuGridPlotWindow::ownerPlotDefinition()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiuGridPlotWindow::ownerViewWindow() const
RimViewWindow* RiuMultiPlotWindow::ownerViewWindow() const
{
return m_plotDefinition;
}
@@ -128,7 +133,7 @@ RimViewWindow* RiuGridPlotWindow::ownerViewWindow() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::addPlot( RiuQwtPlotWidget* plotWidget )
void RiuMultiPlotWindow::addPlot( RiuQwtPlotWidget* plotWidget )
{
// Insert the plot to the left of the scroll bar
insertPlot( plotWidget, m_plotWidgets.size() );
@@ -137,7 +142,7 @@ void RiuGridPlotWindow::addPlot( RiuQwtPlotWidget* plotWidget )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
void RiuMultiPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
{
plotWidget->setDraggable( true ); // Becomes draggable when added to a grid plot window
m_plotWidgets.insert( static_cast<int>( index ), plotWidget );
@@ -171,7 +176,7 @@ void RiuGridPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::removePlot( RiuQwtPlotWidget* plotWidget )
void RiuMultiPlotWindow::removePlot( RiuQwtPlotWidget* plotWidget )
{
if ( !plotWidget ) return;
@@ -198,7 +203,7 @@ void RiuGridPlotWindow::removePlot( RiuQwtPlotWidget* plotWidget )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::setPlotTitle( const QString& plotTitle )
void RiuMultiPlotWindow::setPlotTitle( const QString& plotTitle )
{
m_plotTitle->setText( plotTitle );
}
@@ -206,7 +211,7 @@ void RiuGridPlotWindow::setPlotTitle( const QString& plotTitle )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::setTitleVisible( bool visible )
void RiuMultiPlotWindow::setTitleVisible( bool visible )
{
m_plotTitle->setVisible( visible );
}
@@ -214,11 +219,11 @@ void RiuGridPlotWindow::setTitleVisible( bool visible )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::setSelectionsVisible( bool visible )
void RiuMultiPlotWindow::setSelectionsVisible( bool visible )
{
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
{
if ( visible && caf::SelectionManager::instance()->isSelected( plotWidget->plotOwner(), 0 ) )
if ( visible && caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), 0 ) )
{
plotWidget->setWidgetState( RiuWidgetStyleSheet::SELECTED );
}
@@ -232,7 +237,7 @@ void RiuGridPlotWindow::setSelectionsVisible( bool visible )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::setFontSize( int fontSize )
void RiuMultiPlotWindow::setFontSize( int fontSize )
{
QFont font = m_plotTitle->font();
@@ -244,7 +249,7 @@ void RiuGridPlotWindow::setFontSize( int fontSize )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuGridPlotWindow::fontSize() const
int RiuMultiPlotWindow::fontSize() const
{
return m_plotTitle->font().pointSize() - 1;
}
@@ -252,7 +257,7 @@ int RiuGridPlotWindow::fontSize() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuGridPlotWindow::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
int RiuMultiPlotWindow::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
{
return m_plotWidgets.indexOf( plotWidget );
}
@@ -260,7 +265,7 @@ int RiuGridPlotWindow::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::scheduleUpdate()
void RiuMultiPlotWindow::scheduleUpdate()
{
RiaPlotWindowRedrawScheduler::instance()->schedulePlotWindowUpdate( this );
}
@@ -268,7 +273,7 @@ void RiuGridPlotWindow::scheduleUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::scheduleReplotOfAllPlots()
void RiuMultiPlotWindow::scheduleReplotOfAllPlots()
{
for ( RiuQwtPlotWidget* plotWidget : visiblePlotWidgets() )
{
@@ -279,7 +284,7 @@ void RiuGridPlotWindow::scheduleReplotOfAllPlots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::contextMenuEvent( QContextMenuEvent* event )
void RiuMultiPlotWindow::contextMenuEvent( QContextMenuEvent* event )
{
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
@@ -300,18 +305,10 @@ void RiuGridPlotWindow::contextMenuEvent( QContextMenuEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::keyPressEvent( QKeyEvent* keyEvent )
{
m_plotDefinition->handleKeyPressEvent( keyEvent );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QLabel* RiuGridPlotWindow::createTitleLabel() const
QLabel* RiuMultiPlotWindow::createTitleLabel() const
{
QLabel* plotTitle = new QLabel( "PLOT TITLE HERE", nullptr );
plotTitle->setVisible( m_plotDefinition->isPlotTitleVisible() );
plotTitle->setVisible( m_plotDefinition->isMultiPlotTitleVisible() );
plotTitle->setAlignment( Qt::AlignHCenter );
plotTitle->setWordWrap( true );
plotTitle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
@@ -321,7 +318,7 @@ QLabel* RiuGridPlotWindow::createTitleLabel() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::resizeEvent( QResizeEvent* event )
void RiuMultiPlotWindow::resizeEvent( QResizeEvent* event )
{
QWidget::resizeEvent( event );
bool needsUpdate = false;
@@ -350,7 +347,7 @@ void RiuGridPlotWindow::resizeEvent( QResizeEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::showEvent( QShowEvent* event )
void RiuMultiPlotWindow::showEvent( QShowEvent* event )
{
QWidget::showEvent( event );
performUpdate();
@@ -359,7 +356,7 @@ void RiuGridPlotWindow::showEvent( QShowEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dragEnterEvent( QDragEnterEvent* event )
void RiuMultiPlotWindow::dragEnterEvent( QDragEnterEvent* event )
{
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
if ( source )
@@ -372,7 +369,7 @@ void RiuGridPlotWindow::dragEnterEvent( QDragEnterEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
void RiuMultiPlotWindow::dragMoveEvent( QDragMoveEvent* event )
{
if ( event->answerRect().intersects( this->geometry() ) )
{
@@ -415,7 +412,7 @@ void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
void RiuMultiPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
{
setWidgetState( RiuWidgetStyleSheet::DEFAULT );
@@ -428,7 +425,7 @@ void RiuGridPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::dropEvent( QDropEvent* event )
void RiuMultiPlotWindow::dropEvent( QDropEvent* event )
{
setWidgetState( RiuWidgetStyleSheet::DEFAULT );
@@ -461,13 +458,13 @@ void RiuGridPlotWindow::dropEvent( QDropEvent* event )
}
}
}
RimPlotInterface* insertAfter = nullptr;
RimPlot* insertAfter = nullptr;
if ( beforeIndex > 0 )
{
insertAfter = m_plotWidgets[beforeIndex - 1]->plotDefinition();
}
RimPlotInterface* plotToMove = source->plotDefinition();
RimPlot* plotToMove = source->plotDefinition();
if ( insertAfter != plotToMove )
{
@@ -480,7 +477,7 @@ void RiuGridPlotWindow::dropEvent( QDropEvent* event )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuGridPlotWindow::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
bool RiuMultiPlotWindow::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
{
return true;
}
@@ -488,7 +485,7 @@ bool RiuGridPlotWindow::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidge
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<int, int> RiuGridPlotWindow::rowAndColumnCount( int plotWidgetCount ) const
std::pair<int, int> RiuMultiPlotWindow::rowAndColumnCount( int plotWidgetCount ) const
{
if ( plotWidgetCount == 0 )
{
@@ -503,7 +500,7 @@ std::pair<int, int> RiuGridPlotWindow::rowAndColumnCount( int plotWidgetCount )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
void RiuMultiPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
{
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
{
@@ -513,7 +510,7 @@ void RiuGridPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>&
for ( int changedLevel : changedSelectionLevels )
{
isSelected = isSelected ||
caf::SelectionManager::instance()->isSelected( plotWidget->plotOwner(), changedLevel );
caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), changedLevel );
}
if ( isSelected )
{
@@ -529,7 +526,7 @@ void RiuGridPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::setWidgetState( RiuWidgetStyleSheet::StateTag widgetState )
void RiuMultiPlotWindow::setWidgetState( RiuWidgetStyleSheet::StateTag widgetState )
{
m_dropTargetStyleSheet.setWidgetState( m_dropTargetPlaceHolder, widgetState );
}
@@ -537,7 +534,7 @@ void RiuGridPlotWindow::setWidgetState( RiuWidgetStyleSheet::StateTag widgetStat
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuGridPlotWindow::showYAxis( int row, int column ) const
bool RiuMultiPlotWindow::showYAxis( int row, int column ) const
{
return true;
}
@@ -545,7 +542,7 @@ bool RiuGridPlotWindow::showYAxis( int row, int column ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::performUpdate()
void RiuMultiPlotWindow::performUpdate()
{
reinsertPlotWidgets();
alignCanvasTops();
@@ -554,7 +551,7 @@ void RiuGridPlotWindow::performUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::reinsertPlotWidgets()
void RiuMultiPlotWindow::reinsertPlotWidgets()
{
clearGridLayout();
@@ -569,7 +566,7 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
if ( plotWidgets.empty() )
if ( plotWidgets.empty() && acceptDrops() )
{
m_gridLayout->addWidget( m_dropTargetPlaceHolder, 0, 0 );
m_gridLayout->setRowStretch( 0, 1 );
@@ -585,8 +582,9 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
int column = 0;
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
{
int colSpan = std::min( plotWidgets[visibleIndex]->plotDefinition()->colSpan(), rowAndColumnCount.second );
int rowSpan = plotWidgets[visibleIndex]->plotDefinition()->rowSpan();
int expextedColSpan = static_cast<int>( plotWidgets[visibleIndex]->plotDefinition()->colSpan() );
int colSpan = std::min( expextedColSpan, rowAndColumnCount.second );
int rowSpan = plotWidgets[visibleIndex]->plotDefinition()->rowSpan();
std::tie( row, column ) = findAvailableRowAndColumn( row, column, colSpan, rowAndColumnCount.second );
@@ -628,17 +626,10 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
}
for ( int c = column; c < column + colSpan; ++c )
{
m_gridLayout->setColumnStretch( c, std::max( 1, m_gridLayout->columnStretch( c ) ) );
int colStretch = 1;
if ( showYAxis( row, column ) ) colStretch += 1;
m_gridLayout->setColumnStretch( c, std::max( colStretch, m_gridLayout->columnStretch( c ) ) );
}
// Set column stretches for main widget column based on width scale factor
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
if ( showYAxis( row, column ) )
{
widthScaleFactor += 1; // Give it a bit extra room due to axis
}
m_gridLayout->setColumnStretch( column, std::max( m_gridLayout->columnStretch( column ), widthScaleFactor ) );
}
}
}
@@ -646,7 +637,7 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuGridPlotWindow::alignCanvasTops()
int RiuMultiPlotWindow::alignCanvasTops()
{
CVF_ASSERT( m_legends.size() == m_plotWidgets.size() );
@@ -677,7 +668,7 @@ int RiuGridPlotWindow::alignCanvasTops()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridPlotWindow::clearGridLayout()
void RiuMultiPlotWindow::clearGridLayout()
{
if ( m_gridLayout )
{
@@ -701,7 +692,7 @@ void RiuGridPlotWindow::clearGridLayout()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWidgetStyleSheet RiuGridPlotWindow::createDropTargetStyleSheet()
RiuWidgetStyleSheet RiuMultiPlotWindow::createDropTargetStyleSheet()
{
RiuWidgetStyleSheet styleSheet;
@@ -717,7 +708,7 @@ RiuWidgetStyleSheet RiuGridPlotWindow::createDropTargetStyleSheet()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<QPointer<RiuQwtPlotWidget>> RiuGridPlotWindow::visiblePlotWidgets() const
QList<QPointer<RiuQwtPlotWidget>> RiuMultiPlotWindow::visiblePlotWidgets() const
{
QList<QPointer<RiuQwtPlotWidget>> plotWidgets;
for ( QPointer<RiuQwtPlotWidget> plotWidget : m_plotWidgets )
@@ -733,7 +724,7 @@ QList<QPointer<RiuQwtPlotWidget>> RiuGridPlotWindow::visiblePlotWidgets() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<QPointer<RiuQwtPlotLegend>> RiuGridPlotWindow::visibleLegends() const
QList<QPointer<RiuQwtPlotLegend>> RiuMultiPlotWindow::visibleLegends() const
{
QList<QPointer<RiuQwtPlotLegend>> legends;
for ( int i = 0; i < m_plotWidgets.size(); ++i )
@@ -749,7 +740,7 @@ QList<QPointer<RiuQwtPlotLegend>> RiuGridPlotWindow::visibleLegends() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<QPointer<QLabel>> RiuGridPlotWindow::visibleTitles() const
QList<QPointer<QLabel>> RiuMultiPlotWindow::visibleTitles() const
{
QList<QPointer<QLabel>> subTitles;
for ( int i = 0; i < m_plotWidgets.size(); ++i )
@@ -766,7 +757,7 @@ QList<QPointer<QLabel>> RiuGridPlotWindow::visibleTitles() const
///
//--------------------------------------------------------------------------------------------------
std::pair<int, int>
RiuGridPlotWindow::findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const
RiuMultiPlotWindow::findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const
{
int availableRow = startRow;
int availableColumn = startColumn;

View File

@@ -35,7 +35,7 @@
#include <map>
class RiaPlotWindowRedrawScheduler;
class RimGridPlotWindow;
class RimMultiPlotWindow;
class RiuQwtPlotLegend;
class RiuQwtPlotWidget;
@@ -45,18 +45,19 @@ class QScrollBar;
//==================================================================================================
//
// RiuGridPlotWindow
// RiuMultiPlotWidget
//
//==================================================================================================
class RiuGridPlotWindow : public QWidget, public RiuInterfaceToViewWindow, public caf::SelectionChangedReceiver
class RiuMultiPlotWindow : public QWidget, public RiuInterfaceToViewWindow, public caf::SelectionChangedReceiver
{
Q_OBJECT
public:
RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget* parent = nullptr );
RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent = nullptr );
~RiuMultiPlotWindow() override;
RimGridPlotWindow* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
RimMultiPlotWindow* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void addPlot( RiuQwtPlotWidget* plotWidget );
void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index );
@@ -78,7 +79,6 @@ public:
protected:
void contextMenuEvent( QContextMenuEvent* ) override;
void keyPressEvent( QKeyEvent* keyEvent ) override;
QLabel* createTitleLabel() const;
void resizeEvent( QResizeEvent* event ) override;
@@ -113,17 +113,17 @@ private slots:
virtual void performUpdate();
protected:
QPointer<QVBoxLayout> m_layout;
QPointer<QHBoxLayout> m_plotLayout;
QPointer<QFrame> m_plotWidgetFrame;
QPointer<QGridLayout> m_gridLayout;
QPointer<QLabel> m_plotTitle;
QList<int> m_legendColumns;
QList<QPointer<QLabel>> m_subTitles;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
caf::PdmPointer<RimGridPlotWindow> m_plotDefinition;
QPointer<QLabel> m_dropTargetPlaceHolder;
QPointer<QVBoxLayout> m_layout;
QPointer<QHBoxLayout> m_plotLayout;
QPointer<QFrame> m_plotWidgetFrame;
QPointer<QGridLayout> m_gridLayout;
QPointer<QLabel> m_plotTitle;
QList<int> m_legendColumns;
QList<QPointer<QLabel>> m_subTitles;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
caf::PdmPointer<RimMultiPlotWindow> m_plotDefinition;
QPointer<QLabel> m_dropTargetPlaceHolder;
RiuWidgetStyleSheet m_dropTargetStyleSheet;

View File

@@ -38,8 +38,8 @@
#include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuGridPlotWindow.h"
#include "RiuMdiSubWindow.h"
#include "RiuMultiPlotWindow.h"
#include "RiuToolTipMenu.h"
#include "RiuTreeViewEventFilter.h"
#include "RiuWellAllocationPlot.h"
@@ -158,7 +158,7 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose()
m_wellLogPlotToolBarEditor->clear();
m_summaryPlotToolBarEditor->clear();
m_gridPlotWindowToolBarEditor->clear();
m_multiPlotToolBarEditor->clear();
setWindowTitle( "Plots - ResInsight" );
}
@@ -383,8 +383,8 @@ void RiuPlotMainWindow::createToolBars()
m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Summary Plot", this );
m_summaryPlotToolBarEditor->hide();
m_gridPlotWindowToolBarEditor = new caf::PdmUiToolBarEditor( "Combination Plot", this );
m_gridPlotWindowToolBarEditor->hide();
m_multiPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Multi Plot", this );
m_multiPlotToolBarEditor->hide();
}
//--------------------------------------------------------------------------------------------------
@@ -569,20 +569,20 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateGridPlotWindowToolBar()
void RiuPlotMainWindow::updateMultiPlotToolBar()
{
RimGridPlotWindow* plotWindow = dynamic_cast<RimGridPlotWindow*>( m_activePlotViewWindow.p() );
RimMultiPlotWindow* plotWindow = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
if ( plotWindow )
{
std::vector<caf::PdmFieldHandle*> toolBarFields = {plotWindow->columnCountField()};
m_gridPlotWindowToolBarEditor->setFields( toolBarFields );
m_gridPlotWindowToolBarEditor->updateUi();
m_gridPlotWindowToolBarEditor->show();
m_multiPlotToolBarEditor->setFields( toolBarFields );
m_multiPlotToolBarEditor->updateUi();
m_multiPlotToolBarEditor->show();
}
else
{
m_gridPlotWindowToolBarEditor->clear();
m_gridPlotWindowToolBarEditor->hide();
m_multiPlotToolBarEditor->clear();
m_multiPlotToolBarEditor->hide();
}
refreshToolbars();
}
@@ -592,9 +592,9 @@ void RiuPlotMainWindow::updateGridPlotWindowToolBar()
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi )
{
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimGridPlotWindow* gridPlotWindow = dynamic_cast<RimGridPlotWindow*>( m_activePlotViewWindow.p() );
if ( gridPlotWindow )
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimMultiPlotWindow* multiPlot = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
if ( multiPlot )
{
summaryPlot = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryPlot>();
}
@@ -717,7 +717,7 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
updateWellLogPlotToolBar();
updateSummaryPlotToolBar();
updateGridPlotWindowToolBar();
updateMultiPlotToolBar();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -80,7 +80,7 @@ public:
void addToTemporaryWidgets( QWidget* widget );
void updateWellLogPlotToolBar();
void updateGridPlotWindowToolBar();
void updateMultiPlotToolBar();
void updateSummaryPlotToolBar( bool forceUpdateUi = false );
void setFocusToLineEditInSummaryToolBar();
@@ -121,7 +121,7 @@ private:
QMenu* m_windowMenu;
caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor;
caf::PdmUiToolBarEditor* m_gridPlotWindowToolBarEditor;
caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor;
caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor;
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;

View File

@@ -21,12 +21,12 @@
#include "RiaCurveDataTools.h"
#include "RiaImageTools.h"
#include "RiuQwtSymbol.h"
#include "qwt_date.h"
#include "qwt_interval_symbol.h"
#include "qwt_painter.h"
#include "qwt_plot_intervalcurve.h"
#include "qwt_point_mapper.h"
#include "qwt_scale_map.h"
#include "qwt_symbol.h"
@@ -52,14 +52,6 @@ RiuQwtPlotCurve::RiuQwtPlotCurve( const QString& title )
m_symbolSkipPixelDistance = 10.0f;
m_errorBars = new QwtPlotIntervalCurve();
m_errorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve );
m_errorBars->setSymbol( new QwtIntervalSymbol( QwtIntervalSymbol::Bar ) );
m_errorBars->setItemAttribute( QwtPlotItem::Legend, false );
m_errorBars->setZ( Z_ERROR_BARS );
m_showErrorBars = true;
m_attachedToPlot = nullptr;
m_blackAndWhiteLegendIcon = false;
}
@@ -68,81 +60,6 @@ RiuQwtPlotCurve::RiuQwtPlotCurve( const QString& title )
//--------------------------------------------------------------------------------------------------
RiuQwtPlotCurve::~RiuQwtPlotCurve() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::setSamplesFromXValuesAndYValues( const std::vector<double>& xValues,
const std::vector<double>& yValues,
const std::vector<double>& errorValues,
bool keepOnlyPositiveValues,
ErrorAxis errorAxis )
{
CVF_ASSERT( xValues.size() == yValues.size() );
CVF_ASSERT( errorValues.empty() || errorValues.size() == xValues.size() );
bool showErrorBars = m_showErrorBars && !errorValues.empty();
QPolygonF points;
QVector<QwtIntervalSample> errorIntervals;
std::vector<std::pair<size_t, size_t>> filteredIntervals;
{
std::vector<double> filteredYValues;
std::vector<double> filteredXValues;
std::vector<double> filteredErrorValues;
{
auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues,
keepOnlyPositiveValues );
RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &filteredYValues );
RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &filteredXValues );
if ( showErrorBars )
RiaCurveDataTools::getValuesByIntervals( errorValues, intervalsOfValidValues, &filteredErrorValues );
filteredIntervals = RiaCurveDataTools::computePolyLineStartStopIndices( intervalsOfValidValues );
}
points.reserve( static_cast<int>( filteredXValues.size() ) );
errorIntervals.reserve( static_cast<int>( filteredXValues.size() ) );
for ( size_t i = 0; i < filteredXValues.size(); i++ )
{
points << QPointF( filteredXValues[i], filteredYValues[i] );
if ( showErrorBars && filteredYValues[i] != DOUBLE_INF && filteredErrorValues[i] != DOUBLE_INF )
{
if ( errorAxis == ERROR_ALONG_Y_AXIS )
{
errorIntervals << QwtIntervalSample( filteredXValues[i],
filteredYValues[i] - filteredErrorValues[i],
filteredYValues[i] + filteredErrorValues[i] );
}
else
{
errorIntervals << QwtIntervalSample( filteredYValues[i],
filteredXValues[i] - filteredErrorValues[i],
filteredXValues[i] + filteredErrorValues[i] );
}
}
}
}
this->setSamples( points );
this->setLineSegmentStartStopIndices( filteredIntervals );
if ( showErrorBars )
{
m_errorBars->setSamples( errorIntervals );
if ( errorAxis == ERROR_ALONG_Y_AXIS )
{
m_errorBars->setOrientation( Qt::Vertical );
}
else
{
m_errorBars->setOrientation( Qt::Horizontal );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -150,7 +67,7 @@ void RiuQwtPlotCurve::setSamplesFromXValuesAndYValues( const std::vector<double>
const std::vector<double>& yValues,
bool keepOnlyPositiveValues )
{
setSamplesFromXValuesAndYValues( xValues, yValues, std::vector<double>(), keepOnlyPositiveValues );
computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues );
}
//--------------------------------------------------------------------------------------------------
@@ -160,10 +77,9 @@ void RiuQwtPlotCurve::setSamplesFromDatesAndYValues( const std::vector<QDateTime
const std::vector<double>& yValues,
bool keepOnlyPositiveValues )
{
setSamplesFromXValuesAndYValues( RiuQwtPlotCurve::fromQDateTime( dateTimes ),
yValues,
std::vector<double>(),
keepOnlyPositiveValues );
auto xValues = RiuQwtPlotCurve::fromQDateTime( dateTimes );
computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues );
}
//--------------------------------------------------------------------------------------------------
@@ -173,24 +89,9 @@ void RiuQwtPlotCurve::setSamplesFromTimeTAndYValues( const std::vector<time_t>&
const std::vector<double>& yValues,
bool keepOnlyPositiveValues )
{
setSamplesFromXValuesAndYValues( RiuQwtPlotCurve::fromTime_t( dateTimes ),
yValues,
std::vector<double>(),
keepOnlyPositiveValues );
}
auto xValues = RiuQwtPlotCurve::fromTime_t( dateTimes );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::setSamplesFromTimeTAndYValues( const std::vector<time_t>& dateTimes,
const std::vector<double>& yValues,
const std::vector<double>& yErrorValues,
bool keepOnlyPositiveValues )
{
setSamplesFromXValuesAndYValues( RiuQwtPlotCurve::fromTime_t( dateTimes ),
yValues,
yErrorValues,
keepOnlyPositiveValues );
computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues );
}
//--------------------------------------------------------------------------------------------------
@@ -348,69 +249,6 @@ void RiuQwtPlotCurve::setSymbolSkipPixelDistance( float distance )
m_symbolSkipPixelDistance = distance >= 0.0f ? distance : 0.0f;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::attach( QwtPlot* plot )
{
QwtPlotItem::attach( plot );
if ( m_showErrorBars )
{
m_errorBars->attach( plot );
}
m_attachedToPlot = plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::detach()
{
QwtPlotItem::detach();
m_errorBars->detach();
m_attachedToPlot = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::clearErrorBars()
{
m_errorBars->setSamples( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::showErrorBars( bool show )
{
m_showErrorBars = show;
if ( m_showErrorBars && m_attachedToPlot )
m_errorBars->attach( m_attachedToPlot );
else
m_errorBars->detach();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::setErrorBarsColor( QColor color )
{
QwtIntervalSymbol* newSymbol = new QwtIntervalSymbol( QwtIntervalSymbol::Bar );
newSymbol->setPen( QPen( color ) );
m_errorBars->setSymbol( newSymbol );
}
//--------------------------------------------------------------------------------------------------
/// Set the Qwt X-Axis (QwtPlot::xBottom or QwtPlot::xTop).
/// This is important to make sure the x-axis interval is set correctly.
/// WellLogPlots use top-axis and Summary uses bottom axis.
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::setErrorBarsXAxis( int axis )
{
m_errorBars->setXAxis( axis );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -499,6 +337,26 @@ QwtGraphic RiuQwtPlotCurve::legendIcon( int index, const QSizeF& size ) const
return icon;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector<double>& xValues,
const std::vector<double>& yValues,
bool keepOnlyPositiveValues )
{
auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues );
std::vector<double> validYValues;
std::vector<double> validXValues;
RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &validYValues );
RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &validXValues );
setSamples( validXValues.data(), validYValues.data(), static_cast<int>( validXValues.size() ) );
setLineSegmentStartStopIndices( intervalsOfValidValues );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -23,8 +23,6 @@
#include "qwt_plot_intervalcurve.h"
#include "qwt_symbol.h"
class RiuErrorBarsQwtPlotCurve;
//==================================================================================================
//
// If infinite data is present in the curve data, Qwt is not able to draw a nice curve.
@@ -48,12 +46,6 @@ class RiuErrorBarsQwtPlotCurve;
class RiuQwtPlotCurve : public QwtPlotCurve
{
public:
enum ErrorAxis
{
ERROR_ALONG_X_AXIS,
ERROR_ALONG_Y_AXIS
};
enum CurveInterpolationEnum
{
INTERPOLATION_POINT_TO_POINT,
@@ -87,12 +79,6 @@ public:
const std::vector<double>& yValues,
bool keepOnlyPositiveValues );
void setSamplesFromXValuesAndYValues( const std::vector<double>& xValues,
const std::vector<double>& yValues,
const std::vector<double>& errorValues,
bool keepOnlyPositiveValues,
ErrorAxis errorAxis = ERROR_ALONG_Y_AXIS );
void setSamplesFromDatesAndYValues( const std::vector<QDateTime>& dateTimes,
const std::vector<double>& yValues,
bool keepOnlyPositiveValues );
@@ -101,30 +87,22 @@ public:
const std::vector<double>& yValues,
bool keepOnlyPositiveValues );
void setSamplesFromTimeTAndYValues( const std::vector<time_t>& dateTimes,
const std::vector<double>& yValues,
const std::vector<double>& yErrorValues,
bool keepOnlyPositiveValues );
void setLineSegmentStartStopIndices( const std::vector<std::pair<size_t, size_t>>& lineSegmentStartStopIndices );
void setSymbolSkipPixelDistance( float distance );
void attach( QwtPlot* plot );
void detach();
void clearErrorBars();
void showErrorBars( bool show );
void setErrorBarsColor( QColor color );
void setErrorBarsXAxis( int axis );
void setPerPointLabels( const std::vector<QString>& labels );
void setAppearance( LineStyleEnum lineStyle,
CurveInterpolationEnum interpolationType,
int curveThickness,
const QColor& curveColor );
void setAppearance( LineStyleEnum lineStyle,
CurveInterpolationEnum interpolationType,
int curveThickness,
const QColor& curveColor );
void setBlackAndWhiteLegendIcon( bool blackAndWhite );
QwtGraphic legendIcon( int index, const QSizeF& size ) const override;
static std::vector<double> fromQDateTime( const std::vector<QDateTime>& dateTimes );
static std::vector<double> fromTime_t( const std::vector<time_t>& timeSteps );
protected:
void drawCurve( QPainter* p,
int style,
@@ -143,17 +121,15 @@ protected:
int to ) const override;
private:
static std::vector<double> fromQDateTime( const std::vector<QDateTime>& dateTimes );
static std::vector<double> fromTime_t( const std::vector<time_t>& timeSteps );
void computeValidIntervalsAndSetCurveData( const std::vector<double>& xValues,
const std::vector<double>& yValues,
bool keepOnlyPositiveValues );
private:
std::vector<std::pair<size_t, size_t>> m_polyLineStartStopIndices;
float m_symbolSkipPixelDistance;
bool m_showErrorBars;
QwtPlotIntervalCurve* m_errorBars;
QwtPlot* m_attachedToPlot;
bool m_blackAndWhiteLegendIcon;
float m_symbolSkipPixelDistance;
bool m_blackAndWhiteLegendIcon;
std::vector<QString> m_perPointLabels;
std::vector<std::pair<size_t, size_t>> m_polyLineStartStopIndices;
};

View File

@@ -23,8 +23,8 @@
#include "RiaColorTools.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RimPlot.h"
#include "RimPlotCurve.h"
#include "RimPlotInterface.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtCurvePointTracker.h"
@@ -60,13 +60,11 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidget* parent )
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plot, QWidget* parent )
: QwtPlot( parent )
, m_plotDefinition( plot )
, m_draggable( true )
{
m_plotOwner = dynamic_cast<caf::PdmObject*>( plotTrackDefinition );
CAF_ASSERT( m_plotOwner );
setDefaults();
this->installEventFilter( this );
@@ -78,10 +76,9 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidg
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::~RiuQwtPlotWidget()
{
if ( plotDefinition() )
{
plotDefinition()->detachAllCurves();
}
// The destructor may be called later when deleting with QWidget::deleteLater()
// If you are recreating the widget, then calling something that detaches QwtCurves
// here may cause them to detach from the new widget rather than the old.
}
//--------------------------------------------------------------------------------------------------
@@ -89,9 +86,9 @@ RiuQwtPlotWidget::~RiuQwtPlotWidget()
//--------------------------------------------------------------------------------------------------
bool RiuQwtPlotWidget::isChecked() const
{
if ( plotDefinition() )
if ( m_plotDefinition )
{
return plotDefinition()->isChecked();
return m_plotDefinition->showWindow();
}
return false;
@@ -158,17 +155,9 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotInterface* RiuQwtPlotWidget::plotDefinition() const
RimPlot* RiuQwtPlotWidget::plotDefinition() const
{
return dynamic_cast<RimPlotInterface*>( m_plotOwner.p() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RiuQwtPlotWidget::plotOwner() const
{
return m_plotOwner.p();
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
@@ -428,18 +417,6 @@ QPoint RiuQwtPlotWidget::dragStartPosition() const
return m_clickPosition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuQwtPlotWidget::widthScaleFactor() const
{
if ( plotOwner() )
{
return plotDefinition()->widthScaleFactor();
}
return 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -550,6 +527,10 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
void RiuQwtPlotWidget::hideEvent( QHideEvent* event )
{
resetCurveHighlighting();
if ( m_plotDefinition )
{
m_plotDefinition->detachAllCurves();
}
QwtPlot::hideEvent( event );
}
@@ -564,6 +545,10 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event )
m_canvasStyleSheet = createCanvasStyleSheet();
m_canvasStyleSheet.applyToWidget( canvas() );
if ( m_plotDefinition )
{
m_plotDefinition->reattachAllCurves();
}
QwtPlot::showEvent( event );
}
@@ -623,7 +608,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
axisId = i;
}
}
plotDefinition()->onAxisSelected( axisId, toggleItemInSelection );
m_plotDefinition->onAxisSelected( axisId, toggleItemInSelection );
}
//--------------------------------------------------------------------------------------------------
@@ -683,11 +668,11 @@ void RiuQwtPlotWidget::selectPlotOwner( bool toggleItemInSelection )
{
if ( toggleItemInSelection )
{
RiuPlotMainWindowTools::toggleItemInSelection( plotOwner() );
RiuPlotMainWindowTools::toggleItemInSelection( m_plotDefinition );
}
else
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotOwner() );
RiuPlotMainWindowTools::selectAsCurrentItem( m_plotDefinition );
}
scheduleReplot();
}
@@ -722,10 +707,10 @@ void RiuQwtPlotWidget::selectClosestCurve( const QPoint& pos, bool toggleItemInS
resetCurveHighlighting();
if ( closestCurve && distMin < 20 )
{
if ( plotDefinition() )
if ( m_plotDefinition )
{
RimPlotCurve* selectedCurve = dynamic_cast<RimPlotCurve*>(
plotDefinition()->findPdmObjectFromQwtCurve( closestCurve ) );
m_plotDefinition->findPdmObjectFromQwtCurve( closestCurve ) );
if ( selectedCurve )
{
if ( toggleItemInSelection )

View File

@@ -31,7 +31,7 @@
#include <set>
class RiaPlotWindowRedrawScheduler;
class RimPlotInterface;
class RimPlot;
class QwtLegend;
class QwtPicker;
@@ -53,11 +53,10 @@ class RiuQwtPlotWidget : public QwtPlot
Q_OBJECT
public:
RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidget* parent = nullptr );
RiuQwtPlotWidget( RimPlot* plotTrackDefinition, QWidget* parent = nullptr );
~RiuQwtPlotWidget() override;
RimPlotInterface* plotDefinition() const;
caf::PdmObject* plotOwner() const;
RimPlot* plotDefinition() const;
bool isChecked() const;
@@ -98,8 +97,6 @@ public:
bool frameIsInFrontOfThis( const QRect& frameGeometry );
QPoint dragStartPosition() const;
int widthScaleFactor() const;
void scheduleReplot();
void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState );
@@ -132,7 +129,7 @@ private:
RiuWidgetStyleSheet createCanvasStyleSheet() const;
private:
caf::PdmPointer<caf::PdmObject> m_plotOwner;
caf::PdmPointer<RimPlot> m_plotDefinition;
QPoint m_clickPosition;
std::map<QwtPlot::Axis, QString> m_axisTitles;
std::map<QwtPlot::Axis, bool> m_axisTitlesEnabled;

View File

@@ -23,7 +23,7 @@
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimMainPlotCollection.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimRegularLegendConfig.h"
#include "RimSummaryCase.h"
#include "RimSummaryCurve.h"
@@ -92,7 +92,7 @@ static EnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent /*= nullptr*/ )
RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent /*= nullptr*/ )
: RiuQwtPlotWidget( plotDefinition, parent )
{
// LeftButton for the zooming
@@ -131,6 +131,11 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlotInterface* plotDefinition, QWidget*
setLegendVisible( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSummaryQwtPlot::~RiuSummaryQwtPlot() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -261,7 +266,7 @@ void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event )
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
caf::SelectionManager::instance()->setSelectedItem( plotOwner() );
caf::SelectionManager::instance()->setSelectedItem( plotDefinition() );
menuBuilder << "RicShowPlotDataFeature";
menuBuilder << "RicSavePlotTemplateFeature";

View File

@@ -40,7 +40,8 @@ class RiuSummaryQwtPlot : public RiuQwtPlotWidget, public RiuInterfaceToViewWind
Q_OBJECT;
public:
RiuSummaryQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent = nullptr );
RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent = nullptr );
~RiuSummaryQwtPlot() override;
void useDateBasedTimeAxis(
const QString& dateFormat,

View File

@@ -15,7 +15,7 @@
///
//--------------------------------------------------------------------------------------------------
RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: RiuGridPlotWindow( plotDefinition, parent )
: RiuMultiPlotWindow( plotDefinition, parent )
{
m_trackScrollBar = new QScrollBar( nullptr );
m_trackScrollBar->setOrientation( Qt::Vertical );
@@ -72,6 +72,14 @@ void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisib
m_trackScrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::keyPressEvent( QKeyEvent* event )
{
wellLogPlotDefinition()->handleKeyPressEvent( event );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -17,12 +17,12 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiuGridPlotWindow.h"
#include "RiuMultiPlotWindow.h"
class RiuQwtPlotWidget;
class RimWellLogPlot;
class RiuWellLogPlot : public RiuGridPlotWindow
class RiuWellLogPlot : public RiuMultiPlotWindow
{
Q_OBJECT
public:
@@ -33,6 +33,7 @@ public:
void updateVerticalScrollBar( double minVisible, double maxVisible, double minAvailable, double maxAvailable ) override;
protected:
void keyPressEvent( QKeyEvent* event ) override;
bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const override;
bool showYAxis( int row, int column ) const override;