mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Well Log Plot and Well Distribution Plots no longer inherit Multiplot
* Also cleaned up RiuQwtPlotWidget
This commit is contained in:
parent
2044b99818
commit
edc276db4d
@ -61,6 +61,7 @@
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimObservedSummaryData.h"
|
||||
|
@ -17,8 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
|
||||
#include "RiuMultiPlotBook.h"
|
||||
#include "RiuMultiPlotPage.h"
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@ -41,7 +41,7 @@ RiaPlotWindowRedrawScheduler* RiaPlotWindowRedrawScheduler::instance()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotWindow* plotWindow )
|
||||
void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow )
|
||||
{
|
||||
m_plotWindowsToUpdate.push_back( plotWindow );
|
||||
|
||||
@ -90,26 +90,36 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
|
||||
{
|
||||
std::set<RiuQwtPlotWidget*> updatedPlots;
|
||||
std::set<RiuMultiPlotWindow*> updatedPlotWindows;
|
||||
std::set<RiuMultiPlotPage*> updatedPlotPages;
|
||||
std::vector<QPointer<RiuMultiPlotBook>> plotWindowsToUpdate;
|
||||
std::vector<QPointer<RiuMultiPlotPage>> plotPagesToUpdate;
|
||||
std::vector<QPointer<RiuQwtPlotWidget>> plotWidgetsToReplot;
|
||||
|
||||
for ( RiuMultiPlotWindow* plotWindow : m_plotWindowsToUpdate )
|
||||
plotWindowsToUpdate.swap( m_plotWindowsToUpdate );
|
||||
plotPagesToUpdate.swap( m_plotPagesToUpdate );
|
||||
plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
|
||||
|
||||
std::set<QPointer<RiuQwtPlotWidget>> updatedPlots;
|
||||
std::set<QPointer<RiuMultiPlotBook>> updatedPlotWindows;
|
||||
std::set<QPointer<RiuMultiPlotPage>> updatedPlotPages;
|
||||
|
||||
for ( QPointer<RiuMultiPlotBook> plotWindow : plotWindowsToUpdate )
|
||||
{
|
||||
if ( plotWindow && !updatedPlotWindows.count( plotWindow ) )
|
||||
if ( !plotWindow.isNull() && !updatedPlotWindows.count( plotWindow ) )
|
||||
{
|
||||
plotWindow->performUpdate();
|
||||
updatedPlotWindows.insert( plotWindow );
|
||||
for ( RiuMultiPlotPage* page : plotWindow->pages() )
|
||||
{
|
||||
updatedPlotPages.insert( page );
|
||||
plotPagesToUpdate.erase( std::remove( plotPagesToUpdate.begin(), plotPagesToUpdate.end(), page ),
|
||||
plotPagesToUpdate.end() );
|
||||
}
|
||||
|
||||
plotWindow->performUpdate();
|
||||
updatedPlotWindows.insert( plotWindow );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RiuMultiPlotPage* plotPage : m_plotPagesToUpdate )
|
||||
for ( QPointer<RiuMultiPlotPage> plotPage : plotPagesToUpdate )
|
||||
{
|
||||
if ( plotPage && !updatedPlotPages.count( plotPage ) )
|
||||
if ( !plotPage.isNull() && !updatedPlotPages.count( plotPage ) )
|
||||
{
|
||||
plotPage->performUpdate();
|
||||
updatedPlotPages.insert( plotPage );
|
||||
@ -117,18 +127,14 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
|
||||
}
|
||||
|
||||
// Perform update and replot. Make sure we handle legend update
|
||||
for ( RiuQwtPlotWidget* plot : m_plotWidgetsToReplot )
|
||||
for ( QPointer<RiuQwtPlotWidget> plot : plotWidgetsToReplot )
|
||||
{
|
||||
if ( plot && !updatedPlots.count( plot ) )
|
||||
if ( !plot.isNull() && !updatedPlots.count( plot ) )
|
||||
{
|
||||
plot->replot();
|
||||
updatedPlots.insert( plot );
|
||||
}
|
||||
}
|
||||
|
||||
m_plotWidgetsToReplot.clear();
|
||||
m_plotPagesToUpdate.clear();
|
||||
m_plotWindowsToUpdate.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <vector>
|
||||
|
||||
class RiuMultiPlotPage;
|
||||
class RiuMultiPlotWindow;
|
||||
class RiuMultiPlotBook;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
class RiaPlotWindowRedrawScheduler : public QObject
|
||||
@ -36,7 +36,7 @@ class RiaPlotWindowRedrawScheduler : public QObject
|
||||
|
||||
public:
|
||||
static RiaPlotWindowRedrawScheduler* instance();
|
||||
void scheduleMultiPlotWindowUpdate( RiuMultiPlotWindow* plotWindow );
|
||||
void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow );
|
||||
void scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotWindow );
|
||||
void schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget );
|
||||
void clearAllScheduledUpdates();
|
||||
@ -52,8 +52,8 @@ private:
|
||||
void startTimer( int msecs );
|
||||
|
||||
private:
|
||||
std::vector<QPointer<RiuQwtPlotWidget>> m_plotWidgetsToReplot;
|
||||
std::vector<QPointer<RiuMultiPlotWindow>> m_plotWindowsToUpdate;
|
||||
std::vector<QPointer<RiuMultiPlotPage>> m_plotPagesToUpdate;
|
||||
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
|
||||
std::vector<QPointer<RiuQwtPlotWidget>> m_plotWidgetsToReplot;
|
||||
std::vector<QPointer<RiuMultiPlotBook>> m_plotWindowsToUpdate;
|
||||
std::vector<QPointer<RiuMultiPlotPage>> m_plotPagesToUpdate;
|
||||
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
|
||||
};
|
||||
|
@ -245,7 +245,7 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
for ( RimWellLogPlot* wellLogPlot : wellLogPlots )
|
||||
{
|
||||
QString title = wellLogPlot->multiPlotTitle();
|
||||
QString title = wellLogPlot->description();
|
||||
QString text = wellLogPlot->asciiDataForPlotExport();
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewWindow.h"
|
||||
@ -106,7 +106,7 @@ void RicSnapshotViewToFileFeature::savePlotPDFReportAs( const QString& fileName,
|
||||
pdfPrinter.setResolution( resolution );
|
||||
QRect widgetRect = plot->viewWidget()->contentsRect();
|
||||
|
||||
RimMultiPlotWindow* multiPlot = dynamic_cast<RimMultiPlotWindow*>( plot );
|
||||
RimMultiPlot* multiPlot = dynamic_cast<RimMultiPlot*>( plot );
|
||||
if ( multiPlot && multiPlot->previewModeEnabled() )
|
||||
{
|
||||
QRect pageRect = pdfPrinter.pageLayout().fullRectPixels( resolution );
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
@ -112,7 +112,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
|
||||
if ( dynamic_cast<RimWellLogCurve*>( uiItem ) ) return true;
|
||||
if ( dynamic_cast<RimSummaryPlot*>( uiItem ) )
|
||||
{
|
||||
RimMultiPlotWindow* plotWindow = nullptr;
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
static_cast<RimSummaryPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
|
||||
return plotWindow == nullptr;
|
||||
}
|
||||
@ -144,7 +144,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
|
||||
|
||||
if ( dynamic_cast<RimGridCrossPlot*>( uiItem ) )
|
||||
{
|
||||
RimMultiPlotWindow* plotWindow = nullptr;
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
static_cast<RimGridCrossPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
|
||||
return plotWindow == nullptr;
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
@ -53,7 +53,7 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection();
|
||||
|
||||
RimMultiPlotWindow* plotWindow = new RimMultiPlotWindow;
|
||||
RimMultiPlot* plotWindow = new RimMultiPlot;
|
||||
plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) );
|
||||
plotWindow->setAsPlotMdiWindow();
|
||||
plotCollection->addMultiPlot( plotWindow );
|
||||
@ -68,7 +68,7 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
|
||||
plotWindow->movePlotsToThis( plots, nullptr );
|
||||
}
|
||||
|
||||
plotCollection->updateAllRequiredEditors();
|
||||
project->updateAllRequiredEditors();
|
||||
plotWindow->loadDataAndUpdate();
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded( plotCollection, true );
|
||||
@ -82,13 +82,6 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewMultiPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimMultiPlotCollection* multiPlotCollection =
|
||||
caf::SelectionManager::instance()->selectedItemOfType<RimMultiPlotCollection>();
|
||||
if ( multiPlotCollection )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
auto plots = selectedPlots();
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
@ -116,16 +109,8 @@ void RicNewMultiPlotFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
if ( selectedPlots().empty() )
|
||||
{
|
||||
actionToSetup->setText( "New Empty Multi Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText( "Create Multi Plot from Selected Plots" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
|
||||
}
|
||||
actionToSetup->setText( "Create Multi Plot from Selected Plots" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -97,7 +97,6 @@ RicSummaryCurveCreator::RicSummaryCurveCreator()
|
||||
CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "" );
|
||||
|
||||
m_previewPlot.reset( new RimSummaryPlot() );
|
||||
m_previewPlot->setDraggable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title", "", "", "" );
|
||||
m_useAutoPlotTitleProxy.registerGetMethod( this, &RicSummaryCurveCreator::proxyPlotAutoTitle );
|
||||
|
@ -240,7 +240,7 @@ QWidget* RicSummaryCurveCreatorSplitterUi::getOrCreatePlotWidget()
|
||||
if ( m_summaryCurveCreator )
|
||||
{
|
||||
// TODO: Rename previewPlot()->createViewWidget to getOrCreateViewWidget
|
||||
return m_summaryCurveCreator->previewPlot()->createViewWidget( this->widget() );
|
||||
return m_summaryCurveCreator->previewPlot()->createPlotWidget( this->widget() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -65,7 +65,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot = selectedWellLogPlots.at( 0 );
|
||||
QString defaultFileName = defaultDir + "/" +
|
||||
caf::Utils::makeValidFileBasename( ( wellLogPlot->multiPlotTitle() ) ) + ".ascii";
|
||||
caf::Utils::makeValidFileBasename( ( wellLogPlot->description() ) ) + ".ascii";
|
||||
QString fileName = QFileDialog::getSaveFileName( nullptr,
|
||||
"Select File for Plot Data Export",
|
||||
defaultFileName,
|
||||
@ -81,7 +81,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
std::vector<QString> fileNames;
|
||||
for ( RimWellLogPlot* wellLogPlot : selectedWellLogPlots )
|
||||
{
|
||||
QString fileName = caf::Utils::makeValidFileBasename( wellLogPlot->multiPlotTitle() ) + ".ascii";
|
||||
QString fileName = caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
|
||||
fileNames.push_back( fileName );
|
||||
}
|
||||
|
||||
@ -92,8 +92,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
RiaLogging::info( QString( "Writing to directory %!" ).arg( saveDir ) );
|
||||
for ( RimWellLogPlot* wellLogPlot : selectedWellLogPlots )
|
||||
{
|
||||
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename( wellLogPlot->multiPlotTitle() ) +
|
||||
".ascii";
|
||||
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
|
||||
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( fileName, wellLogPlot );
|
||||
|
||||
progress++;
|
||||
@ -119,8 +118,7 @@ QString RicAsciiExportWellLogPlotFeature::makeValidExportFileName( const RimWell
|
||||
const QString& prefix,
|
||||
bool capitalizeFileName )
|
||||
{
|
||||
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->multiPlotTitle() ) +
|
||||
".ascii";
|
||||
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
|
||||
if ( capitalizeFileName ) fileName = fileName.toUpper();
|
||||
|
||||
QDir dir( folder );
|
||||
@ -143,7 +141,7 @@ bool RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( const QString&
|
||||
|
||||
QTextStream out( &file );
|
||||
|
||||
out << wellLogPlot->multiPlotTitle();
|
||||
out << wellLogPlot->description();
|
||||
out << "\n";
|
||||
out << wellLogPlot->asciiDataForPlotExport();
|
||||
out << "\n\n";
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
@ -50,7 +50,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
|
||||
size_t plotsSelected = 0;
|
||||
for ( caf::PdmObject* object : selection )
|
||||
{
|
||||
RimMultiPlotWindow* multiPlot = nullptr;
|
||||
RimMultiPlot* multiPlot = nullptr;
|
||||
object->firstAncestorOrThisOfType( multiPlot );
|
||||
if ( dynamic_cast<RimPlotWindow*>( object ) && multiPlot )
|
||||
{
|
||||
@ -72,11 +72,11 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
std::vector<RimPlot*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
std::set<RimMultiPlotWindow*> alteredPlotWindows;
|
||||
std::set<RimMultiPlot*> alteredPlotWindows;
|
||||
|
||||
for ( RimPlot* plot : selection )
|
||||
{
|
||||
RimMultiPlotWindow* plotWindow = nullptr;
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
plot->firstAncestorOrThisOfType( plotWindow );
|
||||
if ( plot && plotWindow )
|
||||
{
|
||||
@ -89,7 +89,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimMultiPlotWindow* plotWindow : alteredPlotWindows )
|
||||
for ( RimMultiPlot* plotWindow : alteredPlotWindows )
|
||||
{
|
||||
plotWindow->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
|
||||
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->plotCount() ) );
|
||||
|
||||
pltPlotColl->addPlot( pltPlot );
|
||||
pltPlot->setMultiPlotTitle( plotName );
|
||||
pltPlot->nameConfig()->setCustomName( plotName );
|
||||
|
||||
// pltPlot->applyInitialSelections();
|
||||
pltPlot->loadDataAndUpdate();
|
||||
|
@ -81,7 +81,7 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
|
||||
wellName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name
|
||||
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
|
||||
|
||||
rftPlot->setMultiPlotTitle( plotName );
|
||||
rftPlot->nameConfig()->setCustomName( plotName );
|
||||
|
||||
rftPlot->loadDataAndUpdate();
|
||||
rftPlotColl->updateConnectedEditors();
|
||||
|
@ -102,11 +102,11 @@ RimWellBoreStabilityPlot*
|
||||
auto task = progInfo.task( "Updating all tracks", 5 );
|
||||
|
||||
plot->nameConfig()->setAutoNameTags( true, true, true, false, true );
|
||||
plot->setMultiPlotTitleVisible( true );
|
||||
plot->setPlotTitleVisible( true );
|
||||
plot->setLegendsVisible( true );
|
||||
plot->setLegendsHorizontal( true );
|
||||
plot->setDepthType( RiaDefines::TRUE_VERTICAL_DEPTH );
|
||||
plot->setAutoScaleYEnabled( true );
|
||||
plot->setAutoScaleDepthEnabled( true );
|
||||
|
||||
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ RimWellBoreStabilityPlot*
|
||||
|
||||
if ( !plotDescription.isEmpty() )
|
||||
{
|
||||
plot->setMultiPlotTitle( plotDescription );
|
||||
plot->nameConfig()->setCustomName( plotDescription );
|
||||
}
|
||||
else
|
||||
{
|
||||
plot->setMultiPlotTitle(
|
||||
plot->nameConfig()->setCustomName(
|
||||
QString( "Well Bore Stability Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
|
||||
}
|
||||
|
||||
@ -92,11 +92,12 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
|
||||
|
||||
if ( !plotDescription.isEmpty() )
|
||||
{
|
||||
plot->setMultiPlotTitle( plotDescription );
|
||||
plot->nameConfig()->setCustomName( plotDescription );
|
||||
}
|
||||
else
|
||||
{
|
||||
plot->setMultiPlotTitle( QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
|
||||
plot->nameConfig()->setCustomName(
|
||||
QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
|
||||
}
|
||||
|
||||
if ( showAfterCreation )
|
||||
|
@ -85,8 +85,8 @@ void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
newObject->resolveReferencesRecursively();
|
||||
newObject->initAfterReadRecursively();
|
||||
|
||||
QString description = "Copy of " + newObject->multiPlotTitle();
|
||||
newObject->setMultiPlotTitle( description );
|
||||
QString customName = "Copy of " + newObject->nameConfig()->customName();
|
||||
newObject->nameConfig()->setCustomName( customName );
|
||||
|
||||
newObject->loadDataAndUpdate();
|
||||
|
||||
|
@ -77,7 +77,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
|
||||
@ -229,7 +229,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp
|
||||
@ -310,5 +310,8 @@ list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
@ -103,7 +103,6 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
m_accumulatedWellFlowPlot->setDepthType( RiaDefines::CONNECTION_NUMBER );
|
||||
m_accumulatedWellFlowPlot->setLegendsVisible( false );
|
||||
m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" );
|
||||
m_accumulatedWellFlowPlot->setAcceptDrops( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" );
|
||||
m_totalWellAllocationPlot.uiCapability()->setUiHidden( true );
|
||||
|
@ -290,7 +290,7 @@ void RimWellDistributionPlot::doRemoveFromCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
RiuQwtPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::createViewWidget()");
|
||||
|
||||
@ -303,7 +303,6 @@ QWidget* RimWellDistributionPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
m_plotWidget->setAutoReplot( false );
|
||||
m_plotWidget->setDraggable( false );
|
||||
|
||||
updateLegend();
|
||||
onLoadDataAndUpdate();
|
||||
|
@ -75,11 +75,12 @@ private:
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override;
|
||||
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellDistributionPlot.h"
|
||||
|
||||
@ -27,6 +28,7 @@
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuMultiPlotPage.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
@ -53,7 +55,6 @@ CAF_PDM_SOURCE_INIT( RimWellDistributionPlotCollection, "WellDistributionPlotCol
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
: RimMultiPlotWindow( true )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()");
|
||||
|
||||
@ -73,17 +74,25 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
|
||||
CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
m_plots.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showOil, "ShowOil", true, "Show Oil", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Show Gas", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Show Water", "", "", "" );
|
||||
|
||||
m_plotWindowTitle = "Cumulative Phase Distribution Plots";
|
||||
m_columnCount = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
CAF_PDM_InitField( &m_plotWindowTitle,
|
||||
"PlotDescription",
|
||||
QString( "Cumulative Phase Distribution Plots" ),
|
||||
"Name",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_showPlotLegends = false;
|
||||
m_showWindow = false;
|
||||
|
||||
setAcceptDrops( false );
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::OIL_PHASE ) );
|
||||
@ -94,7 +103,13 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection() {}
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
m_plots.deleteAllChildObjects();
|
||||
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -108,14 +123,104 @@ void RimWellDistributionPlotCollection::setData( RimEclipseResultCase* eclipseCa
|
||||
applyPlotParametersToContainedPlots();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlotCollection::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellDistributionPlotCollection::description() const
|
||||
{
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellDistributionPlotCollection::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
QPixmap pix( m_viewer->size() );
|
||||
m_viewer->renderTo( &pix );
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::zoomAll() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::onLoadDataAndUpdate()");
|
||||
updateMdiWindowVisibility();
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
RimMultiPlotWindow::onLoadDataAndUpdate();
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlotCollection::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_viewer = new RiuMultiPlotPage( this, mainWindowParent );
|
||||
m_viewer->setPlotTitle( m_plotWindowTitle );
|
||||
recreatePlotWidgets();
|
||||
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::deleteViewWidget()
|
||||
{
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->renderTo( paintDevice );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::addPlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
size_t index = m_plots.size();
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -147,8 +252,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
RimWellDistributionPlotCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimMultiPlotWindow::calculateValueOptions( fieldNeedingOptions,
|
||||
useOptionsOnly );
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
@ -225,13 +329,12 @@ void RimWellDistributionPlotCollection::fieldChangedByUi( const caf::PdmFieldHan
|
||||
shouldRecalculatePlotData = true;
|
||||
}
|
||||
|
||||
RimMultiPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( shouldRecalculatePlotData )
|
||||
{
|
||||
updateLayout();
|
||||
|
||||
loadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,11 +343,11 @@ void RimWellDistributionPlotCollection::fieldChangedByUi( const caf::PdmFieldHan
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
{
|
||||
const size_t numPlots = plotCount();
|
||||
const size_t numPlots = m_plots.size();
|
||||
for ( size_t i = 0; i < numPlots; i++ )
|
||||
{
|
||||
// Dirty usage of dyn_cast, but type is lost when adding the plots to our base class
|
||||
RimWellDistributionPlot* aPlot = dynamic_cast<RimWellDistributionPlot*>( plotByIndex( i ) );
|
||||
RimWellDistributionPlot* aPlot = dynamic_cast<RimWellDistributionPlot*>( m_plots[i] );
|
||||
if ( aPlot )
|
||||
{
|
||||
if ( aPlot->phase() == RiaDefines::PhaseType::OIL_PHASE )
|
||||
@ -266,6 +369,54 @@ void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::updatePlots()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
{
|
||||
for ( RimPlot* plot : m_plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::cleanupBeforeClose()
|
||||
{
|
||||
auto plotVector = m_plots.childObjects();
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
plotVector[tIdx]->detachAllCurves();
|
||||
}
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setParent( nullptr );
|
||||
delete m_viewer;
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
for ( auto plot : m_plots() )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->addPlot( plot->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,8 +19,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
@ -29,7 +31,9 @@
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class RimPlot;
|
||||
class RigTofWellDistributionCalculator;
|
||||
class RiuMultiPlotPage;
|
||||
|
||||
class QTextBrowser;
|
||||
class QwtPlot;
|
||||
@ -39,7 +43,7 @@ class QwtPlot;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimWellDistributionPlotCollection : public RimMultiPlotWindow
|
||||
class RimWellDistributionPlotCollection : public RimPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -49,6 +53,11 @@ public:
|
||||
|
||||
void setData( RimEclipseResultCase* eclipseCase, QString wellName, int timeStepIndex );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QString description() const override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
|
||||
private:
|
||||
// RimPlotWindow overrides
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
@ -57,12 +66,20 @@ private:
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
|
||||
private:
|
||||
void addPlot( RimPlot* plot );
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
void applyPlotParametersToContainedPlots();
|
||||
void updatePlots();
|
||||
void cleanupBeforeClose();
|
||||
void recreatePlotWidgets();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
@ -72,7 +89,12 @@ private:
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
caf::PdmField<double> m_maximumTof;
|
||||
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmChildArrayField<RimPlot*> m_plots;
|
||||
|
||||
caf::PdmField<bool> m_showOil;
|
||||
caf::PdmField<bool> m_showGas;
|
||||
caf::PdmField<bool> m_showWater;
|
||||
|
||||
QPointer<RiuMultiPlotPage> m_viewer;
|
||||
};
|
||||
|
@ -893,7 +893,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
if ( changedField == &m_wellPathName )
|
||||
{
|
||||
setMultiPlotTitle( QString( plotNameFormatString() ).arg( m_wellPathName ) );
|
||||
m_nameConfig->setCustomName( QString( plotNameFormatString() ).arg( m_wellPathName ) );
|
||||
}
|
||||
|
||||
if ( changedField == &m_wellPathName )
|
||||
|
@ -878,7 +878,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
if ( changedField == &m_wellPathNameOrSimWellName )
|
||||
{
|
||||
setMultiPlotTitle( QString( plotNameFormatString() ).arg( m_wellPathNameOrSimWellName ) );
|
||||
m_nameConfig->setCustomName( QString( plotNameFormatString() ).arg( m_wellPathNameOrSimWellName ) );
|
||||
|
||||
m_branchIndex = 0;
|
||||
|
||||
|
@ -25,4 +25,8 @@ list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.h
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\GridCrossPlots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimGridCrossPlotCurve.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
@ -436,7 +436,17 @@ QString RimGridCrossPlot::generateInfoBoxText() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
void RimGridCrossPlot::onPlotZoomed()
|
||||
{
|
||||
setAutoScaleXEnabled( false );
|
||||
setAutoScaleYEnabled( false );
|
||||
updateZoomFromQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
@ -446,9 +456,11 @@ QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
|
||||
}
|
||||
}
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
updateCurveNamesAndPlotTitle();
|
||||
|
||||
this->connect( m_plotWidget, SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) );
|
||||
}
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
@ -540,9 +552,9 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
else
|
||||
else if ( changedField == &m_showInfoBox )
|
||||
{
|
||||
onLoadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,10 +616,9 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setTitle( this->createAutoName() );
|
||||
}
|
||||
QString plotTitle = this->createAutoName();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( isMdiWindow() );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
@ -790,11 +801,14 @@ void RimGridCrossPlot::doUpdateLayout()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateLegend()
|
||||
{
|
||||
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
dataSet->updateLegendIcons();
|
||||
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
dataSet->updateLegendIcons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ private:
|
||||
|
||||
class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface
|
||||
{
|
||||
Q_OBJECT;
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
@ -112,12 +113,11 @@ public:
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
protected:
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
@ -142,12 +142,17 @@ protected:
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void doUpdateLayout() override;
|
||||
void cleanupBeforeClose();
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
QString generateInfoBoxText() const;
|
||||
|
||||
private slots:
|
||||
void onPlotZoomed();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showInfoBox;
|
||||
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
||||
|
@ -72,7 +72,7 @@ void RimGridCrossPlotCurve::setSamples( const std::vector<double>& xValues, cons
|
||||
{
|
||||
CVF_ASSERT( xValues.size() == yValues.size() );
|
||||
|
||||
if ( xValues.empty() || yValues.empty() ) return;
|
||||
if ( xValues.empty() || yValues.empty() || !m_qwtPlotCurve ) return;
|
||||
|
||||
m_qwtPlotCurve->setSamples( &xValues[0], &yValues[0], static_cast<int>( xValues.size() ) );
|
||||
}
|
||||
@ -107,6 +107,8 @@ size_t RimGridCrossPlotCurve::sampleCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::determineLegendIcon()
|
||||
{
|
||||
if ( !m_qwtPlotCurve ) return;
|
||||
|
||||
RimGridCrossPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
int fontSize = plot->legendFontSize();
|
||||
@ -118,7 +120,10 @@ void RimGridCrossPlotCurve::determineLegendIcon()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite )
|
||||
{
|
||||
m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimPltPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
@ -262,7 +263,7 @@ void RimMainPlotCollection::updatePlotsWithFormations()
|
||||
|
||||
if ( m_multiPlotCollection )
|
||||
{
|
||||
for ( RimMultiPlotWindow* plotWindow : m_multiPlotCollection->multiPlots() )
|
||||
for ( RimMultiPlot* plotWindow : m_multiPlotCollection->multiPlots() )
|
||||
{
|
||||
plotWindow->loadDataAndUpdate();
|
||||
}
|
||||
@ -284,7 +285,7 @@ void RimMainPlotCollection::updatePlotsWithCompletions()
|
||||
|
||||
if ( m_multiPlotCollection )
|
||||
{
|
||||
for ( RimMultiPlotWindow* plotWindow : m_multiPlotCollection->multiPlots() )
|
||||
for ( RimMultiPlot* plotWindow : m_multiPlotCollection->multiPlots() )
|
||||
{
|
||||
plotWindow->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -15,11 +15,13 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuMultiPlotBook.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
@ -31,48 +33,46 @@
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void RimMultiPlotWindow::ColumnCountEnum::setUp()
|
||||
void RimMultiPlot::ColumnCountEnum::setUp()
|
||||
{
|
||||
addItem( RimMultiPlotWindow::COLUMNS_1, "1", "1 Column" );
|
||||
addItem( RimMultiPlotWindow::COLUMNS_2, "2", "2 Columns" );
|
||||
addItem( RimMultiPlotWindow::COLUMNS_3, "3", "3 Columns" );
|
||||
addItem( RimMultiPlotWindow::COLUMNS_4, "4", "4 Columns" );
|
||||
addItem( RimMultiPlotWindow::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
|
||||
setDefault( RimMultiPlotWindow::COLUMNS_2 );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_1, "1", "1 Column" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_2, "2", "2 Columns" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_3, "3", "3 Columns" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_4, "4", "4 Columns" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
|
||||
setDefault( RimMultiPlot::ColumnCount::COLUMNS_2 );
|
||||
}
|
||||
template <>
|
||||
void RimMultiPlotWindow::RowCountEnum::setUp()
|
||||
void RimMultiPlot::RowCountEnum::setUp()
|
||||
{
|
||||
addItem( RimMultiPlotWindow::ROWS_1, "1", "1 Row" );
|
||||
addItem( RimMultiPlotWindow::ROWS_2, "2", "2 Rows" );
|
||||
addItem( RimMultiPlotWindow::ROWS_3, "3", "3 Rows" );
|
||||
addItem( RimMultiPlotWindow::ROWS_4, "4", "4 Rows" );
|
||||
setDefault( RimMultiPlotWindow::ROWS_2 );
|
||||
addItem( RimMultiPlot::ROWS_1, "1", "1 Row" );
|
||||
addItem( RimMultiPlot::ROWS_2, "2", "2 Rows" );
|
||||
addItem( RimMultiPlot::ROWS_3, "3", "3 Rows" );
|
||||
addItem( RimMultiPlot::ROWS_4, "4", "4 Rows" );
|
||||
setDefault( RimMultiPlot::ROWS_2 );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimMultiPlotWindow, "MultiPlot" );
|
||||
CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow::RimMultiPlotWindow( bool hidePlotsInTreeView )
|
||||
: m_acceptDrops( true )
|
||||
RimMultiPlot::RimMultiPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Multi Plot", ":/WellLogPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" );
|
||||
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
m_plots.uiCapability()->setUiTreeChildrenHidden( hidePlotsInTreeView );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", false, "Show Sub Plot Titles", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", true, "Show Sub Plot Titles", "", "", "" );
|
||||
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
@ -80,7 +80,7 @@ RimMultiPlotWindow::RimMultiPlotWindow( bool hidePlotsInTreeView )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow::~RimMultiPlotWindow()
|
||||
RimMultiPlot::~RimMultiPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
m_plots.deleteAllChildObjects();
|
||||
@ -91,7 +91,7 @@ RimMultiPlotWindow::~RimMultiPlotWindow()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Move-assignment operator. Argument has to be passed with std::move()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow& RimMultiPlotWindow::operator=( RimMultiPlotWindow&& rhs )
|
||||
RimMultiPlot& RimMultiPlot::operator=( RimMultiPlot&& rhs )
|
||||
{
|
||||
RimPlotWindow::operator=( std::move( rhs ) );
|
||||
|
||||
@ -112,15 +112,13 @@ RimMultiPlotWindow& RimMultiPlotWindow::operator=( RimMultiPlotWindow&& rhs )
|
||||
m_rowsPerPage = rhs.m_rowsPerPage;
|
||||
m_showIndividualPlotTitles = rhs.m_showIndividualPlotTitles;
|
||||
|
||||
m_acceptDrops = rhs.m_acceptDrops;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimMultiPlotWindow::viewWidget()
|
||||
QWidget* RimMultiPlot::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
@ -128,7 +126,7 @@ QWidget* RimMultiPlotWindow::viewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimMultiPlotWindow::description() const
|
||||
QString RimMultiPlot::description() const
|
||||
{
|
||||
return multiPlotTitle();
|
||||
}
|
||||
@ -136,7 +134,7 @@ QString RimMultiPlotWindow::description() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimMultiPlotWindow::isMultiPlotTitleVisible() const
|
||||
bool RimMultiPlot::isMultiPlotTitleVisible() const
|
||||
{
|
||||
return m_showPlotWindowTitle;
|
||||
}
|
||||
@ -144,7 +142,7 @@ bool RimMultiPlotWindow::isMultiPlotTitleVisible() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::setMultiPlotTitleVisible( bool visible )
|
||||
void RimMultiPlot::setMultiPlotTitleVisible( bool visible )
|
||||
{
|
||||
m_showPlotWindowTitle = visible;
|
||||
}
|
||||
@ -152,7 +150,7 @@ void RimMultiPlotWindow::setMultiPlotTitleVisible( bool visible )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimMultiPlotWindow::multiPlotTitle() const
|
||||
QString RimMultiPlot::multiPlotTitle() const
|
||||
{
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
@ -160,7 +158,7 @@ QString RimMultiPlotWindow::multiPlotTitle() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::setMultiPlotTitle( const QString& title )
|
||||
void RimMultiPlot::setMultiPlotTitle( const QString& title )
|
||||
{
|
||||
m_plotWindowTitle = title;
|
||||
}
|
||||
@ -168,7 +166,7 @@ void RimMultiPlotWindow::setMultiPlotTitle( const QString& title )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::addPlot( RimPlot* plot )
|
||||
void RimMultiPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
@ -176,7 +174,7 @@ void RimMultiPlotWindow::addPlot( RimPlot* plot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::insertPlot( RimPlot* plot, size_t index )
|
||||
void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
@ -188,7 +186,7 @@ void RimMultiPlotWindow::insertPlot( RimPlot* plot, size_t index )
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
plot->updateAfterInsertingIntoMultiPlot();
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
@ -197,7 +195,7 @@ void RimMultiPlotWindow::insertPlot( RimPlot* plot, size_t index )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::removePlot( RimPlot* plot )
|
||||
void RimMultiPlot::removePlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
@ -214,11 +212,11 @@ void RimMultiPlotWindow::removePlot( RimPlot* plot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
|
||||
void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
|
||||
{
|
||||
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
|
||||
{
|
||||
RimMultiPlotWindow* previousMultiPlotWindow = nullptr;
|
||||
RimMultiPlot* previousMultiPlotWindow = nullptr;
|
||||
plotsToMove[tIdx]->firstAncestorOrThisOfType( previousMultiPlotWindow );
|
||||
if ( previousMultiPlotWindow )
|
||||
{
|
||||
@ -245,7 +243,7 @@ void RimMultiPlotWindow::movePlotsToThis( const std::vector<RimPlot*>& plotsToMo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimMultiPlotWindow::plotCount() const
|
||||
size_t RimMultiPlot::plotCount() const
|
||||
{
|
||||
return m_plots.size();
|
||||
}
|
||||
@ -253,7 +251,7 @@ size_t RimMultiPlotWindow::plotCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimMultiPlotWindow::plotIndex( const RimPlot* plot ) const
|
||||
size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const
|
||||
{
|
||||
return m_plots.index( plot );
|
||||
}
|
||||
@ -261,7 +259,7 @@ size_t RimMultiPlotWindow::plotIndex( const RimPlot* plot ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot* RimMultiPlotWindow::plotByIndex( size_t index ) const
|
||||
RimPlot* RimMultiPlot::plotByIndex( size_t index ) const
|
||||
{
|
||||
return m_plots[index];
|
||||
}
|
||||
@ -269,7 +267,7 @@ RimPlot* RimMultiPlotWindow::plotByIndex( size_t index ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlot*> RimMultiPlotWindow::plots() const
|
||||
std::vector<RimPlot*> RimMultiPlot::plots() const
|
||||
{
|
||||
return m_plots.childObjects();
|
||||
}
|
||||
@ -277,7 +275,7 @@ std::vector<RimPlot*> RimMultiPlotWindow::plots() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlot*> RimMultiPlotWindow::visiblePlots() const
|
||||
std::vector<RimPlot*> RimMultiPlot::visiblePlots() const
|
||||
{
|
||||
std::vector<RimPlot*> allVisiblePlots;
|
||||
for ( RimPlot* plot : m_plots() )
|
||||
@ -293,10 +291,13 @@ std::vector<RimPlot*> RimMultiPlotWindow::visiblePlots() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::doUpdateLayout()
|
||||
void RimMultiPlot::doUpdateLayout()
|
||||
{
|
||||
if ( m_showWindow && m_viewer )
|
||||
{
|
||||
m_viewer->setPlotTitle( description() );
|
||||
m_viewer->setTitleVisible( m_showPlotWindowTitle );
|
||||
m_viewer->setSubTitlesVisible( m_showIndividualPlotTitles );
|
||||
m_viewer->scheduleUpdate();
|
||||
m_viewer->adjustSize();
|
||||
}
|
||||
@ -305,28 +306,17 @@ void RimMultiPlotWindow::doUpdateLayout()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Empty default implementation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::updateSubPlotNames() {}
|
||||
void RimMultiPlot::updateSubPlotNames() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Empty default implementation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::updatePlotWindowTitle() {}
|
||||
void RimMultiPlot::updatePlotWindowTitle() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::doSetAutoScaleYEnabled( bool enabled )
|
||||
{
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
plot->setAutoScaleYEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
void RimMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
@ -337,7 +327,7 @@ void RimMultiPlotWindow::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::updatePlotOrderFromGridWidget()
|
||||
void RimMultiPlot::updatePlotOrderFromGridWidget()
|
||||
{
|
||||
std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) {
|
||||
auto indexLhs = m_viewer->indexOfPlotWidget( lhs->viewer() );
|
||||
@ -351,7 +341,7 @@ void RimMultiPlotWindow::updatePlotOrderFromGridWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::setAutoScaleXEnabled( bool enabled )
|
||||
void RimMultiPlot::setAutoScaleXEnabled( bool enabled )
|
||||
{
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
@ -362,27 +352,30 @@ void RimMultiPlotWindow::setAutoScaleXEnabled( bool enabled )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::setAutoScaleYEnabled( bool enabled )
|
||||
void RimMultiPlot::setAutoScaleYEnabled( bool enabled )
|
||||
{
|
||||
doSetAutoScaleYEnabled( enabled );
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
plot->setAutoScaleYEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMultiPlotWindow::columnCount() const
|
||||
int RimMultiPlot::columnCount() const
|
||||
{
|
||||
if ( m_columnCount() == COLUMNS_UNLIMITED )
|
||||
if ( m_columnCount() == ColumnCount::COLUMNS_UNLIMITED )
|
||||
{
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
return static_cast<int>( m_columnCount() );
|
||||
return static_cast<int>( m_columnCount().value() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMultiPlotWindow::rowsPerPage() const
|
||||
int RimMultiPlot::rowsPerPage() const
|
||||
{
|
||||
return static_cast<int>( m_rowsPerPage() );
|
||||
}
|
||||
@ -390,7 +383,7 @@ int RimMultiPlotWindow::rowsPerPage() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimMultiPlotWindow::columnCountField()
|
||||
caf::PdmFieldHandle* RimMultiPlot::columnCountField()
|
||||
{
|
||||
return &m_columnCount;
|
||||
}
|
||||
@ -398,7 +391,7 @@ caf::PdmFieldHandle* RimMultiPlotWindow::columnCountField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimMultiPlotWindow::rowsPerPageField()
|
||||
caf::PdmFieldHandle* RimMultiPlot::rowsPerPageField()
|
||||
{
|
||||
return &m_rowsPerPage;
|
||||
}
|
||||
@ -406,7 +399,7 @@ caf::PdmFieldHandle* RimMultiPlotWindow::rowsPerPageField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimMultiPlotWindow::showPlotTitles() const
|
||||
bool RimMultiPlot::showPlotTitles() const
|
||||
{
|
||||
return m_showIndividualPlotTitles;
|
||||
}
|
||||
@ -414,7 +407,7 @@ bool RimMultiPlotWindow::showPlotTitles() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::zoomAll()
|
||||
void RimMultiPlot::zoomAll()
|
||||
{
|
||||
setAutoScaleXEnabled( true );
|
||||
setAutoScaleYEnabled( true );
|
||||
@ -424,7 +417,7 @@ void RimMultiPlotWindow::zoomAll()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimMultiPlotWindow::asciiDataForPlotExport() const
|
||||
QString RimMultiPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString out = multiPlotTitle() + "\n";
|
||||
|
||||
@ -442,7 +435,7 @@ QString RimMultiPlotWindow::asciiDataForPlotExport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::onPlotAdditionOrRemoval()
|
||||
void RimMultiPlot::onPlotAdditionOrRemoval()
|
||||
{
|
||||
updateSubPlotNames();
|
||||
updatePlotWindowTitle();
|
||||
@ -455,23 +448,7 @@ void RimMultiPlotWindow::onPlotAdditionOrRemoval()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::setAcceptDrops( bool acceptDrops )
|
||||
{
|
||||
m_acceptDrops = acceptDrops;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimMultiPlotWindow::acceptDrops() const
|
||||
{
|
||||
return m_acceptDrops;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimMultiPlotWindow::previewModeEnabled() const
|
||||
bool RimMultiPlot::previewModeEnabled() const
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
@ -483,7 +460,7 @@ bool RimMultiPlotWindow::previewModeEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimMultiPlotWindow::snapshotWindowContent()
|
||||
QImage RimMultiPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
@ -500,20 +477,21 @@ QImage RimMultiPlotWindow::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimMultiPlotWindow::createViewWidget( QWidget* mainWindowParent )
|
||||
QWidget* RimMultiPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( m_viewer.isNull() )
|
||||
{
|
||||
m_viewer = new RiuMultiPlotWindow( this, mainWindowParent );
|
||||
m_viewer = new RiuMultiPlotBook( this, mainWindowParent );
|
||||
}
|
||||
recreatePlotWidgets();
|
||||
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::deleteViewWidget()
|
||||
void RimMultiPlot::deleteViewWidget()
|
||||
{
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
@ -521,7 +499,7 @@ void RimMultiPlotWindow::deleteViewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimMultiPlotWindow::userDescriptionField()
|
||||
caf::PdmFieldHandle* RimMultiPlot::userDescriptionField()
|
||||
{
|
||||
return &m_plotWindowTitle;
|
||||
}
|
||||
@ -529,9 +507,9 @@ caf::PdmFieldHandle* RimMultiPlotWindow::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
@ -555,7 +533,7 @@ void RimMultiPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
void RimMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
|
||||
uiOrderingForMultiPlotLayout( uiConfigName, *titleAndLegendsGroup );
|
||||
@ -564,7 +542,7 @@ void RimMultiPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
void RimMultiPlot::uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_showPlotWindowTitle );
|
||||
uiOrdering.add( &m_plotWindowTitle );
|
||||
@ -577,8 +555,8 @@ void RimMultiPlotWindow::uiOrderingForMultiPlotLayout( QString uiConfigName, caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimMultiPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
QList<caf::PdmOptionItemInfo> RimMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
@ -587,7 +565,7 @@ QList<caf::PdmOptionItemInfo> RimMultiPlotWindow::calculateValueOptions( const c
|
||||
for ( size_t i = 0; i < ColumnCountEnum::size(); ++i )
|
||||
{
|
||||
ColumnCount enumVal = ColumnCountEnum::fromIndex( i );
|
||||
if ( enumVal == COLUMNS_UNLIMITED )
|
||||
if ( enumVal == ColumnCount::COLUMNS_UNLIMITED )
|
||||
{
|
||||
QString iconPath( ":/ColumnsUnlimited.png" );
|
||||
options.push_back( caf::PdmOptionItemInfo( ColumnCountEnum::uiText( enumVal ),
|
||||
@ -611,7 +589,7 @@ QList<caf::PdmOptionItemInfo> RimMultiPlotWindow::calculateValueOptions( const c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::onLoadDataAndUpdate()
|
||||
void RimMultiPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
updatePlotWindowTitle();
|
||||
@ -623,7 +601,7 @@ void RimMultiPlotWindow::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::initAfterRead()
|
||||
void RimMultiPlot::initAfterRead()
|
||||
{
|
||||
RimPlotWindow::initAfterRead();
|
||||
}
|
||||
@ -631,7 +609,7 @@ void RimMultiPlotWindow::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::applyPlotWindowTitleToWidgets()
|
||||
void RimMultiPlot::applyPlotWindowTitleToWidgets()
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
@ -644,7 +622,7 @@ void RimMultiPlotWindow::applyPlotWindowTitleToWidgets()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::updatePlots()
|
||||
void RimMultiPlot::updatePlots()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
{
|
||||
@ -659,7 +637,7 @@ void RimMultiPlotWindow::updatePlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::updateZoom()
|
||||
void RimMultiPlot::updateZoom()
|
||||
{
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
@ -670,7 +648,7 @@ void RimMultiPlotWindow::updateZoom()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::recreatePlotWidgets()
|
||||
void RimMultiPlot::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
@ -686,7 +664,7 @@ void RimMultiPlotWindow::recreatePlotWidgets()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimMultiPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
|
||||
bool RimMultiPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
|
||||
{
|
||||
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
|
||||
{
|
||||
@ -712,10 +690,10 @@ bool RimMultiPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSet
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimMultiPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false */ )
|
||||
bool RimMultiPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false */ )
|
||||
{
|
||||
bool somethingChanged = false;
|
||||
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
|
||||
@ -750,7 +728,7 @@ bool RimMultiPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingT
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::cleanupBeforeClose()
|
||||
void RimMultiPlot::cleanupBeforeClose()
|
||||
{
|
||||
auto plotVector = plots();
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
@ -18,7 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RiuMultiPlotInterface.h"
|
||||
#include "RiuMultiPlotBook.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@ -34,19 +34,12 @@
|
||||
|
||||
class RimPlot;
|
||||
|
||||
class RimMultiPlotWindow : public RimPlotWindow
|
||||
class RimMultiPlot : public RimPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum ColumnCount
|
||||
{
|
||||
COLUMNS_1 = 1,
|
||||
COLUMNS_2 = 2,
|
||||
COLUMNS_3 = 3,
|
||||
COLUMNS_4 = 4,
|
||||
COLUMNS_UNLIMITED = 1000,
|
||||
};
|
||||
using ColumnCount = RiuMultiPlotBook::ColumnCount;
|
||||
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
|
||||
|
||||
enum RowCount
|
||||
@ -59,10 +52,10 @@ public:
|
||||
using RowCountEnum = caf::AppEnum<RowCount>;
|
||||
|
||||
public:
|
||||
RimMultiPlotWindow( bool hidePlotsInTreeView = false );
|
||||
~RimMultiPlotWindow() override;
|
||||
RimMultiPlot();
|
||||
~RimMultiPlot() override;
|
||||
|
||||
RimMultiPlotWindow& operator=( RimMultiPlotWindow&& rhs );
|
||||
RimMultiPlot& operator=( RimMultiPlot&& rhs );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
|
||||
@ -90,7 +83,7 @@ public:
|
||||
void setAutoScaleXEnabled( bool enabled );
|
||||
void setAutoScaleYEnabled( bool enabled );
|
||||
|
||||
int columnCount() const;
|
||||
int columnCount() const override;
|
||||
int rowsPerPage() const;
|
||||
caf::PdmFieldHandle* columnCountField();
|
||||
caf::PdmFieldHandle* rowsPerPageField();
|
||||
@ -98,10 +91,7 @@ public:
|
||||
|
||||
void zoomAll() override;
|
||||
|
||||
QString asciiDataForPlotExport() const;
|
||||
virtual void onPlotAdditionOrRemoval();
|
||||
void setAcceptDrops( bool acceptDrops );
|
||||
bool acceptDrops() const;
|
||||
QString asciiDataForPlotExport() const;
|
||||
|
||||
bool previewModeEnabled() const;
|
||||
|
||||
@ -125,10 +115,10 @@ protected:
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
|
||||
void applyPlotWindowTitleToWidgets();
|
||||
void updatePlots();
|
||||
virtual void updateZoom();
|
||||
void recreatePlotWidgets();
|
||||
void applyPlotWindowTitleToWidgets();
|
||||
void updatePlots();
|
||||
void updateZoom();
|
||||
void recreatePlotWidgets();
|
||||
|
||||
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
||||
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
@ -137,12 +127,12 @@ protected:
|
||||
bool forceChange = false ) override;
|
||||
|
||||
private:
|
||||
void cleanupBeforeClose();
|
||||
void doUpdateLayout() override;
|
||||
virtual void updateSubPlotNames();
|
||||
virtual void updatePlotWindowTitle();
|
||||
virtual void doSetAutoScaleYEnabled( bool enabled );
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void cleanupBeforeClose();
|
||||
void doUpdateLayout() override;
|
||||
void updateSubPlotNames();
|
||||
void updatePlotWindowTitle();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void onPlotAdditionOrRemoval();
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
@ -151,11 +141,9 @@ protected:
|
||||
caf::PdmField<RowCountEnum> m_rowsPerPage;
|
||||
caf::PdmField<bool> m_showIndividualPlotTitles;
|
||||
|
||||
friend class RiuMultiPlotInterface;
|
||||
QPointer<RiuMultiPlotInterface> m_viewer;
|
||||
friend class RiuMultiPlotBook;
|
||||
QPointer<RiuMultiPlotBook> m_viewer;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimPlot*> m_plots;
|
||||
|
||||
bool m_acceptDrops;
|
||||
};
|
@ -18,7 +18,7 @@
|
||||
#include "RimMultiPlotCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimMultiPlotCollection, "RimMultiPlotCollection" );
|
||||
@ -50,7 +50,7 @@ void RimMultiPlotCollection::deleteAllChildObjects()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimMultiPlotWindow*> RimMultiPlotCollection::multiPlots() const
|
||||
std::vector<RimMultiPlot*> RimMultiPlotCollection::multiPlots() const
|
||||
{
|
||||
return m_multiPlots.childObjects();
|
||||
}
|
||||
@ -58,9 +58,9 @@ std::vector<RimMultiPlotWindow*> RimMultiPlotCollection::multiPlots() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow* RimMultiPlotCollection::createMultiPlot()
|
||||
RimMultiPlot* RimMultiPlotCollection::createMultiPlot()
|
||||
{
|
||||
RimMultiPlotWindow* plot = new RimMultiPlotWindow();
|
||||
RimMultiPlot* plot = new RimMultiPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
addMultiPlot( plot );
|
||||
@ -70,7 +70,7 @@ RimMultiPlotWindow* RimMultiPlotCollection::createMultiPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotCollection::addMultiPlot( RimMultiPlotWindow* plot )
|
||||
void RimMultiPlotCollection::addMultiPlot( RimMultiPlot* plot )
|
||||
{
|
||||
m_multiPlots().push_back( plot );
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimMultiPlotWindow;
|
||||
class RimMultiPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -36,10 +36,10 @@ public:
|
||||
|
||||
void deleteAllChildObjects();
|
||||
|
||||
std::vector<RimMultiPlotWindow*> multiPlots() const;
|
||||
RimMultiPlotWindow* createMultiPlot();
|
||||
void addMultiPlot( RimMultiPlotWindow* plot );
|
||||
std::vector<RimMultiPlot*> multiPlots() const;
|
||||
RimMultiPlot* createMultiPlot();
|
||||
void addMultiPlot( RimMultiPlot* plot );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimMultiPlotWindow*> m_multiPlots;
|
||||
caf::PdmChildArrayField<RimMultiPlot*> m_multiPlots;
|
||||
};
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "RimPlot.h"
|
||||
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
@ -43,9 +45,24 @@ RimPlot::~RimPlot() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::createPlotWidget()
|
||||
QWidget* RimPlot::createViewWidget( QWidget* parent /*= nullptr */ )
|
||||
{
|
||||
createViewWidget( nullptr );
|
||||
RiuQwtPlotWidget* plotWidget = doCreatePlotViewWidget( parent );
|
||||
|
||||
RimPlot::attachPlotWidgetSignals( this, plotWidget );
|
||||
|
||||
updateWindowVisibility();
|
||||
plotWidget->scheduleReplot();
|
||||
|
||||
return plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimPlot::createPlotWidget( QWidget* parent )
|
||||
{
|
||||
return createViewWidget( parent );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -70,6 +87,7 @@ RimPlot::RowOrColSpan RimPlot::colSpan() const
|
||||
void RimPlot::setRowSpan( RowOrColSpan rowSpan )
|
||||
{
|
||||
m_rowSpan = rowSpan;
|
||||
updateParentLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -78,6 +96,7 @@ void RimPlot::setRowSpan( RowOrColSpan rowSpan )
|
||||
void RimPlot::setColSpan( RowOrColSpan colSpan )
|
||||
{
|
||||
m_colSpan = colSpan;
|
||||
updateParentLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -99,6 +118,7 @@ void RimPlot::updateAfterInsertingIntoMultiPlot()
|
||||
{
|
||||
updateLegend();
|
||||
updateAxes();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -118,10 +138,32 @@ void RimPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrde
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showWindow )
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
else if ( changedField == &m_colSpan || changedField == &m_rowSpan )
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::attachPlotWidgetSignals( RimPlot* plot, RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
CAF_ASSERT( plot && plotWidget );
|
||||
plot->connect( plotWidget, SIGNAL( plotSelected( bool ) ), SLOT( onPlotSelected( bool ) ) );
|
||||
plot->connect( plotWidget, SIGNAL( axisSelected( int, bool ) ), SLOT( onAxisSelected( int, bool ) ) );
|
||||
plot->connect( plotWidget,
|
||||
SIGNAL( curveSelected( QwtPlotCurve*, bool ) ),
|
||||
SLOT( onCurveSelected( QwtPlotCurve*, bool ) ) );
|
||||
plot->connect( plotWidget, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), SLOT( onKeyPressEvent( QKeyEvent* ) ) );
|
||||
plot->connect( plotWidget, SIGNAL( onWheelEvent( QWheelEvent* ) ), SLOT( onWheelEvent( QWheelEvent* ) ) );
|
||||
plot->connect( plotWidget, SIGNAL( destroyed() ), SLOT( onViewerDestroyed() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -134,3 +176,63 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
viewer()->renderTo( paintDevice, viewer()->frameGeometry() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::onPlotSelected( bool toggle )
|
||||
{
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::onCurveSelected( QwtPlotCurve* curve, bool toggle )
|
||||
{
|
||||
RimPlotCurve* selectedCurve = dynamic_cast<RimPlotCurve*>( this->findPdmObjectFromQwtCurve( curve ) );
|
||||
if ( selectedCurve )
|
||||
{
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( selectedCurve );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( selectedCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::onViewerDestroyed()
|
||||
{
|
||||
m_showWindow = false;
|
||||
updateConnectedEditors();
|
||||
updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::onKeyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
handleKeyPressEvent( event );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::onWheelEvent( QWheelEvent* event )
|
||||
{
|
||||
handleWheelEvent( event );
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
class RiuQwtPlotWidget;
|
||||
@ -33,13 +34,15 @@ class RimPlotCurve;
|
||||
class QwtPlotCurve;
|
||||
|
||||
class QPaintDevice;
|
||||
class QWheelEvent;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlot : public RimPlotWindow
|
||||
class RimPlot : public QObject, public RimPlotWindow
|
||||
{
|
||||
Q_OBJECT;
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
@ -58,8 +61,7 @@ public:
|
||||
RimPlot();
|
||||
virtual ~RimPlot();
|
||||
|
||||
// Real implementations
|
||||
void createPlotWidget();
|
||||
QWidget* createPlotWidget( QWidget* parent = nullptr );
|
||||
RowOrColSpan rowSpan() const;
|
||||
RowOrColSpan colSpan() const;
|
||||
void setRowSpan( RowOrColSpan rowSpan );
|
||||
@ -80,22 +82,33 @@ public:
|
||||
|
||||
virtual QString asciiDataForPlotExport() const = 0;
|
||||
|
||||
virtual void reattachAllCurves() = 0;
|
||||
virtual void detachAllCurves() = 0;
|
||||
|
||||
virtual void reattachAllCurves() = 0;
|
||||
virtual void detachAllCurves() = 0;
|
||||
virtual caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const = 0;
|
||||
|
||||
virtual void onAxisSelected( int axis, bool toggle ) = 0;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
static void attachPlotWidgetSignals( RimPlot* plot, RiuQwtPlotWidget* plotWidget );
|
||||
QWidget* createViewWidget( QWidget* parent = nullptr ) final;
|
||||
|
||||
private:
|
||||
virtual void doRemoveFromCollection() = 0;
|
||||
virtual void doRenderWindowContent( QPaintDevice* paintDevice );
|
||||
virtual void doRemoveFromCollection() = 0;
|
||||
virtual void doRenderWindowContent( QPaintDevice* paintDevice );
|
||||
virtual void handleKeyPressEvent( QKeyEvent* event ) {}
|
||||
virtual void handleWheelEvent( QWheelEvent* event ) {}
|
||||
virtual RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* parent ) = 0;
|
||||
|
||||
private slots:
|
||||
void onPlotSelected( bool toggle );
|
||||
virtual void onAxisSelected( int axis, bool toggle ) = 0;
|
||||
void onCurveSelected( QwtPlotCurve* curve, bool toggle );
|
||||
void onViewerDestroyed();
|
||||
void onKeyPressEvent( QKeyEvent* event );
|
||||
void onWheelEvent( QWheelEvent* event );
|
||||
|
||||
protected:
|
||||
caf::PdmField<RowOrColSpanEnum> m_rowSpan;
|
||||
|
@ -430,13 +430,16 @@ void RimPlotCurve::updateCurveName()
|
||||
m_curveName = m_customCurveName;
|
||||
}
|
||||
|
||||
if ( !m_legendEntryText().isEmpty() )
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setTitle( m_legendEntryText );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setTitle( m_curveName );
|
||||
if ( !m_legendEntryText().isEmpty() )
|
||||
{
|
||||
m_qwtPlotCurve->setTitle( m_legendEntryText );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setTitle( m_curveName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,6 +562,45 @@ void RimPlotCurve::setSamplesFromXYErrorValues(
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSamplesFromXYValues( const std::vector<double>& xValues,
|
||||
const std::vector<double>& yValues,
|
||||
bool keepOnlyPositiveValues )
|
||||
{
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector<QDateTime>& dateTimes,
|
||||
const std::vector<double>& yValues,
|
||||
bool keepOnlyPositiveValues )
|
||||
{
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, keepOnlyPositiveValues );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector<time_t>& dateTimes,
|
||||
const std::vector<double>& yValues,
|
||||
bool keepOnlyPositiveValues )
|
||||
{
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, keepOnlyPositiveValues );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -591,7 +633,7 @@ void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateUiIconFromPlotSymbol()
|
||||
{
|
||||
if ( m_pointSymbol() != RiuQwtSymbol::NoSymbol )
|
||||
if ( m_pointSymbol() != RiuQwtSymbol::NoSymbol && m_qwtPlotCurve )
|
||||
{
|
||||
CVF_ASSERT( RiaGuiApplication::isRunning() );
|
||||
QColor curveColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
||||
@ -651,8 +693,6 @@ void RimPlotCurve::attachCurveAndErrorBars()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveAppearance()
|
||||
{
|
||||
CVF_ASSERT( m_qwtPlotCurve );
|
||||
|
||||
QColor curveColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
||||
QwtSymbol* symbol = nullptr;
|
||||
|
||||
@ -681,33 +721,38 @@ void RimPlotCurve::updateCurveAppearance()
|
||||
symbol->setPen( curveColor );
|
||||
}
|
||||
}
|
||||
m_qwtPlotCurve->setAppearance( m_lineStyle(), m_curveInterpolation(), m_curveThickness(), curveColor );
|
||||
m_qwtPlotCurve->setSymbol( symbol );
|
||||
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_symbolSkipPixelDistance() );
|
||||
|
||||
if ( m_qwtCurveErrorBars )
|
||||
{
|
||||
QwtIntervalSymbol* newSymbol = new QwtIntervalSymbol( QwtIntervalSymbol::Bar );
|
||||
newSymbol->setPen( QPen( curveColor ) );
|
||||
m_qwtCurveErrorBars->setSymbol( newSymbol );
|
||||
}
|
||||
|
||||
// Make sure the legend lines are long enough to distinguish between line types.
|
||||
// Standard width in Qwt is 8 which is too short.
|
||||
// Use 10 and scale this by curve thickness + add space for displaying symbol.
|
||||
if ( m_lineStyle() != RiuQwtPlotCurve::STYLE_NONE )
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||
m_qwtPlotCurve->setAppearance( m_lineStyle(), m_curveInterpolation(), m_curveThickness(), curveColor );
|
||||
m_qwtPlotCurve->setSymbol( symbol );
|
||||
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_symbolSkipPixelDistance() );
|
||||
|
||||
int symbolWidth = 0;
|
||||
if ( symbol )
|
||||
// Make sure the legend lines are long enough to distinguish between line types.
|
||||
// Standard width in Qwt is 8 which is too short.
|
||||
// Use 10 and scale this by curve thickness + add space for displaying symbol.
|
||||
if ( m_lineStyle() != RiuQwtPlotCurve::STYLE_NONE )
|
||||
{
|
||||
symbolWidth = symbol->boundingRect().size().width() + 2;
|
||||
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||
|
||||
int symbolWidth = 0;
|
||||
if ( symbol )
|
||||
{
|
||||
symbolWidth = symbol->boundingRect().size().width() + 2;
|
||||
}
|
||||
|
||||
int width = std::max( 10 * m_curveThickness, ( symbolWidth * 3 ) / 2 );
|
||||
|
||||
legendIconSize.setWidth( width );
|
||||
m_qwtPlotCurve->setLegendIconSize( legendIconSize );
|
||||
}
|
||||
|
||||
int width = std::max( 10 * m_curveThickness, ( symbolWidth * 3 ) / 2 );
|
||||
|
||||
legendIconSize.setWidth( width );
|
||||
m_qwtPlotCurve->setLegendIconSize( legendIconSize );
|
||||
}
|
||||
}
|
||||
|
||||
@ -923,6 +968,8 @@ void RimPlotCurve::updateLegendEntryVisibilityAndPlotLegend()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
|
||||
{
|
||||
if ( !m_qwtPlotCurve ) return;
|
||||
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
if ( ensembleCurveSet )
|
||||
|
@ -128,6 +128,16 @@ protected:
|
||||
const std::vector<double>& errorValues,
|
||||
bool keepOnlyPositiveValues,
|
||||
RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ERROR_ALONG_Y_AXIS );
|
||||
void setSamplesFromXYValues( const std::vector<double>& xValues,
|
||||
const std::vector<double>& yValues,
|
||||
bool keepOnlyPositiveValues );
|
||||
void setSamplesFromDatesAndYValues( const std::vector<QDateTime>& dateTimes,
|
||||
const std::vector<double>& yValues,
|
||||
bool keepOnlyPositiveValues );
|
||||
|
||||
void setSamplesFromTimeTAndYValues( const std::vector<time_t>& dateTimes,
|
||||
const std::vector<double>& yValues,
|
||||
bool keepOnlyPositiveValues );
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RiuMultiPlotPage.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
@ -155,6 +156,14 @@ void RimPlotWindow::updateParentLayout()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimPlotWindow::columnCount() const
|
||||
{
|
||||
return static_cast<int>( RiuMultiPlotPage::ColumnCount::COLUMNS_UNLIMITED );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -186,6 +195,11 @@ void RimPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showWindow )
|
||||
{
|
||||
updateWindowVisibility();
|
||||
}
|
||||
|
||||
if ( changedField == &m_showPlotLegends || changedField == &m_plotLegendsHorizontal )
|
||||
{
|
||||
updateLayout();
|
||||
@ -250,6 +264,21 @@ bool RimPlotWindow::hasCustomPageLayout( QPageLayout* customPageLayout ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::updateWindowVisibility()
|
||||
{
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
#include <QPageLayout>
|
||||
|
||||
class RimPlot;
|
||||
class RimProject;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
class QwtPlotCurve;
|
||||
class QKeyEvent;
|
||||
@ -49,17 +51,18 @@ public:
|
||||
RimPlotWindow& operator=( RimPlotWindow&& rhs );
|
||||
|
||||
virtual QString description() const = 0;
|
||||
|
||||
bool legendsVisible() const;
|
||||
void setLegendsVisible( bool doShow );
|
||||
bool legendsHorizontal() const;
|
||||
void setLegendsHorizontal( bool horizontal );
|
||||
int legendFontSize() const;
|
||||
void setLegendFontSize( int fontSize );
|
||||
bool legendsVisible() const;
|
||||
void setLegendsVisible( bool doShow );
|
||||
bool legendsHorizontal() const;
|
||||
void setLegendsHorizontal( bool horizontal );
|
||||
int legendFontSize() const;
|
||||
void setLegendFontSize( int fontSize );
|
||||
|
||||
void updateLayout();
|
||||
void updateParentLayout();
|
||||
|
||||
virtual int columnCount() const;
|
||||
|
||||
void renderWindowContent( QPaintDevice* painter );
|
||||
QPageLayout pageLayout() const;
|
||||
|
||||
@ -72,6 +75,7 @@ protected:
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||
void updateWindowVisibility();
|
||||
|
||||
private:
|
||||
virtual void doUpdateLayout() {}
|
||||
|
@ -1357,7 +1357,8 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() );
|
||||
}
|
||||
|
||||
if ( mainPlotCollection->multiPlotCollection() )
|
||||
if ( mainPlotCollection->multiPlotCollection() &&
|
||||
!mainPlotCollection->multiPlotCollection()->multiPlots().empty() )
|
||||
{
|
||||
itemCollection->add( mainPlotCollection->multiPlotCollection() );
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
@ -182,7 +183,7 @@ void RimReloadCaseTools::updateAllPlots()
|
||||
RimMultiPlotCollection* multiPlotCollection = project->mainPlotCollection()->multiPlotCollection();
|
||||
if ( multiPlotCollection )
|
||||
{
|
||||
for ( RimMultiPlotWindow* plotWindow : multiPlotCollection->multiPlots() )
|
||||
for ( RimMultiPlot* plotWindow : multiPlotCollection->multiPlots() )
|
||||
{
|
||||
plotWindow->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class RimGeoMechCase;
|
||||
class RimWellPath;
|
||||
|
||||
class RimWellBoreStabilityPlot : public RimWellLogPlot
|
||||
{
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
using ParameterSource = RigGeoMechWellLogExtractor::WbsParameterSource;
|
||||
|
@ -176,7 +176,7 @@ void RimWellLogCurve::updateZoomInParentPlot()
|
||||
&maxCurveDepth );
|
||||
if ( minCurveDepth < minPlotDepth - eps * plotRange || maxCurveDepth > maxPlotDepth + eps * plotRange )
|
||||
{
|
||||
wellLogPlot->setAutoScaleYEnabled( true );
|
||||
wellLogPlot->setAutoScaleDepthEnabled( true );
|
||||
wellLogPlot->updateZoom();
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,11 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
m_commonDataSource.xmlCapability()->disableIO();
|
||||
m_commonDataSource = new RimWellLogCurveCommonDataSource;
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" );
|
||||
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
|
||||
|
||||
caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = RiaDefines::MEASURED_DEPTH;
|
||||
CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" );
|
||||
|
||||
@ -102,6 +107,9 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_nameConfig = new RimWellLogPlotNameConfig();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
|
||||
m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET};
|
||||
m_availableDepthTypes = {RiaDefines::MEASURED_DEPTH,
|
||||
RiaDefines::TRUE_VERTICAL_DEPTH,
|
||||
@ -111,11 +119,9 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
m_maxAvailableDepth = -HUGE_VAL;
|
||||
|
||||
m_commonDataSourceEnabled = true;
|
||||
m_columnCount = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
|
||||
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
|
||||
m_plotLegendsHorizontal = false;
|
||||
setMultiPlotTitleVisible( false );
|
||||
setPlotTitleVisible( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -123,7 +129,21 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
|
||||
{
|
||||
RimMultiPlotWindow::operator=( std::move( rhs ) );
|
||||
RimPlotWindow::operator=( std::move( rhs ) );
|
||||
|
||||
// Move all tracks
|
||||
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
|
||||
rhs.m_plots.clear();
|
||||
for ( RimPlot* plot : plots )
|
||||
{
|
||||
m_plots.push_back( plot );
|
||||
}
|
||||
|
||||
// Deliberately don't set m_plotWindowTitle. This operator is used for copying parameters from children.
|
||||
// This only happens for some plots that used to own a plot but now inherits the plot.
|
||||
// These all had their own description at top level which we don't want to overwrite.
|
||||
|
||||
m_showPlotWindowTitle = rhs.m_showPlotWindowTitle;
|
||||
|
||||
auto dataSource = rhs.m_commonDataSource();
|
||||
rhs.m_commonDataSource.removeChildObject( dataSource );
|
||||
@ -152,6 +172,19 @@ RimWellLogPlot::~RimWellLogPlot()
|
||||
{
|
||||
delete m_commonDataSource;
|
||||
delete m_nameConfig;
|
||||
|
||||
removeMdiWindowFromMdiArea();
|
||||
m_plots.deleteAllChildObjects();
|
||||
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -162,6 +195,124 @@ QWidget* RimWellLogPlot::createPlotWidget( QWidget* mainWindowParent /*= nullptr
|
||||
return createViewWidget( mainWindowParent );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogPlot::description() const
|
||||
{
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlot::isPlotTitleVisible() const
|
||||
{
|
||||
return m_showPlotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setPlotTitleVisible( bool visible )
|
||||
{
|
||||
m_showPlotWindowTitle = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::removePlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removePlot( plot->viewer() );
|
||||
}
|
||||
m_plots.removeChildObject( plot );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimWellLogPlot::plotCount() const
|
||||
{
|
||||
return m_plots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimWellLogPlot::plotIndex( const RimPlot* plot ) const
|
||||
{
|
||||
return m_plots.index( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot* RimWellLogPlot::plotByIndex( size_t index ) const
|
||||
{
|
||||
return m_plots[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlot*> RimWellLogPlot::plots() const
|
||||
{
|
||||
return m_plots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlot*> RimWellLogPlot::visiblePlots() const
|
||||
{
|
||||
std::vector<RimPlot*> allVisiblePlots;
|
||||
for ( RimPlot* plot : m_plots() )
|
||||
{
|
||||
if ( plot->showWindow() )
|
||||
{
|
||||
allVisiblePlots.push_back( plot );
|
||||
}
|
||||
}
|
||||
return allVisiblePlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -180,6 +331,7 @@ void RimWellLogPlot::updateZoom()
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
static_cast<RimWellLogTrack*>( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() );
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
|
||||
if ( m_viewer )
|
||||
@ -189,8 +341,6 @@ void RimWellLogPlot::updateZoom()
|
||||
m_minAvailableDepth,
|
||||
m_maxAvailableDepth );
|
||||
}
|
||||
|
||||
RimMultiPlotWindow::updateZoom();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -224,7 +374,7 @@ void RimWellLogPlot::setDepthAxisRange( double minimumDepth, double maximumDepth
|
||||
m_minVisibleDepth.uiCapability()->updateConnectedEditors();
|
||||
m_maxVisibleDepth.uiCapability()->updateConnectedEditors();
|
||||
|
||||
setAutoScaleYEnabled( false );
|
||||
setAutoScaleDepthEnabled( false );
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
@ -399,6 +549,23 @@ RimWellLogPlotNameConfig* RimWellLogPlot::nameConfig() const
|
||||
return m_nameConfig;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellLogPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
QPixmap pix( m_viewer->size() );
|
||||
m_viewer->renderTo( &pix );
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -409,14 +576,43 @@ QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::deleteViewWidget()
|
||||
{
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::performAutoNameUpdate()
|
||||
{
|
||||
updateCommonDataSource();
|
||||
setMultiPlotTitle( createAutoName() );
|
||||
applyPlotWindowTitleToWidgets();
|
||||
m_plotWindowTitle = createAutoName();
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setTitleVisible( m_showPlotWindowTitle() );
|
||||
m_viewer->setPlotTitle( m_plotWindowTitle );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
auto plotVector = plots();
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
plotVector[tIdx]->createPlotWidget();
|
||||
m_viewer->addPlot( plotVector[tIdx]->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -502,6 +698,24 @@ void RimWellLogPlot::setAvailableDepthTypes( const std::set<DepthTypeEnum>& dept
|
||||
m_availableDepthTypes = depthTypes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString out = description() + "\n";
|
||||
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
if ( plot->showWindow() )
|
||||
{
|
||||
out += plot->asciiDataForPlotExport();
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -509,7 +723,36 @@ void RimWellLogPlot::onPlotAdditionOrRemoval()
|
||||
{
|
||||
calculateAvailableDepthRange();
|
||||
updateZoom();
|
||||
RimMultiPlotWindow::onPlotAdditionOrRemoval();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->renderTo( paintDevice );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::cleanupBeforeClose()
|
||||
{
|
||||
auto plotVector = plots();
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
plotVector[tIdx]->detachAllCurves();
|
||||
}
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setParent( nullptr );
|
||||
delete m_viewer;
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -532,23 +775,6 @@ void RimWellLogPlot::updateSubPlotNames()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updatePlotWindowTitle()
|
||||
{
|
||||
performAutoNameUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::doSetAutoScaleYEnabled( bool on )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = on;
|
||||
m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -556,7 +782,7 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimMultiPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth )
|
||||
{
|
||||
@ -623,7 +849,6 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
|
||||
RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, *plotLayoutGroup );
|
||||
plotLayoutGroup->add( &m_columnCount );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@ -634,8 +859,7 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimMultiPlotWindow::calculateValueOptions( fieldNeedingOptions,
|
||||
useOptionsOnly );
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_depthType )
|
||||
{
|
||||
@ -668,7 +892,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::initAfterRead()
|
||||
{
|
||||
RimMultiPlotWindow::initAfterRead();
|
||||
RimPlotWindow::initAfterRead();
|
||||
|
||||
if ( m_depthAxisGridVisibility() == AXIS_GRID_MINOR )
|
||||
{
|
||||
@ -690,15 +914,7 @@ void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_columnCount )
|
||||
{
|
||||
auto comboAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
|
||||
if ( comboAttr )
|
||||
{
|
||||
comboAttr->iconSize = QSize( 24, 14 );
|
||||
}
|
||||
}
|
||||
else if ( field == &m_minVisibleDepth || field == &m_maxVisibleDepth )
|
||||
if ( field == &m_minVisibleDepth || field == &m_maxVisibleDepth )
|
||||
{
|
||||
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
|
||||
if ( doubleAttr )
|
||||
@ -709,6 +925,40 @@ void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
performAutoNameUpdate();
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updatePlots()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
{
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
this->updateZoom();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellLogPlot::userDescriptionField()
|
||||
{
|
||||
return &m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -797,6 +1047,36 @@ RimWellLogPlot::AxisGridVisibility RimWellLogPlot::depthAxisGridLinesEnabled() c
|
||||
return m_depthAxisGridVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setAutoScaleXEnabled( bool enabled )
|
||||
{
|
||||
for ( RimPlot* plot : plots() )
|
||||
{
|
||||
plot->setAutoScaleXEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setAutoScaleDepthEnabled( bool enabled )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = enabled;
|
||||
m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::zoomAll()
|
||||
{
|
||||
setAutoScaleXEnabled( true );
|
||||
setAutoScaleDepthEnabled( true );
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include <QPointer>
|
||||
@ -35,15 +35,15 @@
|
||||
#include <set>
|
||||
|
||||
class RimWellLogCurveCommonDataSource;
|
||||
class RiuMultiPlotPage;
|
||||
class RimPlotWindow;
|
||||
class RiuWellLogPlot;
|
||||
class RimPlot;
|
||||
class QKeyEvent;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogPlot : public RimMultiPlotWindow, public RimNameConfigHolderInterface
|
||||
class RimWellLogPlot : public RimPlotWindow, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -63,10 +63,26 @@ public:
|
||||
RimWellLogPlot();
|
||||
~RimWellLogPlot() override;
|
||||
|
||||
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
|
||||
|
||||
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
|
||||
QString description() const override;
|
||||
|
||||
bool isPlotTitleVisible() const;
|
||||
void setPlotTitleVisible( bool visible );
|
||||
|
||||
void addPlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index );
|
||||
void removePlot( RimPlot* plot );
|
||||
|
||||
size_t plotCount() const;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
RimPlot* plotByIndex( size_t index ) const;
|
||||
|
||||
std::vector<RimPlot*> plots() const;
|
||||
std::vector<RimPlot*> visiblePlots() const;
|
||||
|
||||
DepthTypeEnum depthType() const;
|
||||
void setDepthType( DepthTypeEnum depthType );
|
||||
|
||||
@ -77,7 +93,11 @@ public:
|
||||
void enableDepthAxisGridLines( AxisGridVisibility gridVisibility );
|
||||
AxisGridVisibility depthAxisGridLinesEnabled() const;
|
||||
|
||||
void updateZoom() override;
|
||||
void setAutoScaleXEnabled( bool enabled );
|
||||
void setAutoScaleDepthEnabled( bool enabled );
|
||||
|
||||
void zoomAll() override;
|
||||
void updateZoom();
|
||||
void setDepthAxisRangeByFactorAndCenter( double zoomFactor, double zoomCenter );
|
||||
void setDepthAxisRangeByPanDepth( double panFactor );
|
||||
void setDepthAxisRange( double minimumDepth, double maximumDepth );
|
||||
@ -99,13 +119,16 @@ public:
|
||||
void setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits );
|
||||
void setAvailableDepthTypes( const std::set<DepthTypeEnum>& depthTypes );
|
||||
|
||||
void onPlotAdditionOrRemoval() override;
|
||||
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent );
|
||||
QString asciiDataForPlotExport() const;
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent );
|
||||
|
||||
protected:
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
void performAutoNameUpdate() override;
|
||||
void recreatePlotWidgets();
|
||||
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
@ -115,20 +138,26 @@ protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void initAfterRead() override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void initAfterRead() override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void updatePlots();
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
void updateSubPlotNames() override;
|
||||
void updatePlotWindowTitle() override;
|
||||
void doSetAutoScaleYEnabled( bool enabled ) override;
|
||||
void cleanupBeforeClose();
|
||||
void updateSubPlotNames();
|
||||
void onPlotAdditionOrRemoval();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
|
||||
protected:
|
||||
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
|
||||
bool m_commonDataSourceEnabled;
|
||||
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
|
||||
caf::PdmField<double> m_minVisibleDepth;
|
||||
@ -137,7 +166,9 @@ protected:
|
||||
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
|
||||
|
||||
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
|
||||
caf::PdmChildArrayField<RimPlot*> m_plots;
|
||||
|
||||
QPointer<RiuWellLogPlot> m_viewer;
|
||||
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;
|
||||
std::set<DepthTypeEnum> m_availableDepthTypes;
|
||||
|
||||
|
@ -78,8 +78,13 @@
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QWheelEvent>
|
||||
|
||||
#define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0
|
||||
#define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0
|
||||
#define RI_SCROLLWHEEL_ZOOMFACTOR 1.1
|
||||
#define RI_SCROLLWHEEL_PANFACTOR 0.1
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellLogTrack, "WellLogPlotTrack" );
|
||||
|
||||
@ -482,11 +487,11 @@ void RimWellLogTrack::updateYZoom()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::doRemoveFromCollection()
|
||||
{
|
||||
RimMultiPlotWindow* multiPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( multiPlot );
|
||||
if ( multiPlot )
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
multiPlot->removePlot( this );
|
||||
wellLogPlot->removePlot( this );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1296,21 +1301,18 @@ RimWellLogTrack::TrajectoryType RimWellLogTrack::formationTrajectoryType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogTrack::createViewWidget( QWidget* mainWindowParent )
|
||||
RiuQwtPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( m_plotWidget == nullptr )
|
||||
{
|
||||
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
|
||||
m_plotWidget->setAxisInverted( QwtPlot::yLeft );
|
||||
|
||||
updateAxisScaleEngine();
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
{
|
||||
m_curves[cIdx]->setParentQwtPlotNoReplot( this->m_plotWidget );
|
||||
}
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
return m_plotWidget;
|
||||
}
|
||||
@ -1760,6 +1762,38 @@ RimWellLogPlot* RimWellLogTrack::parentWellLogPlot() const
|
||||
return wellLogPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::handleWheelEvent( QWheelEvent* event )
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
if ( event->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
QwtScaleMap scaleMap = m_plotWidget->canvasMap( QwtPlot::yLeft );
|
||||
double zoomCenter = scaleMap.invTransform( event->pos().y() );
|
||||
|
||||
if ( event->delta() > 0 )
|
||||
{
|
||||
wellLogPlot->setDepthAxisRangeByFactorAndCenter( RI_SCROLLWHEEL_ZOOMFACTOR, zoomCenter );
|
||||
}
|
||||
else
|
||||
{
|
||||
wellLogPlot->setDepthAxisRangeByFactorAndCenter( 1.0 / RI_SCROLLWHEEL_ZOOMFACTOR, zoomCenter );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wellLogPlot->setDepthAxisRangeByPanDepth( event->delta() < 0 ? RI_SCROLLWHEEL_PANFACTOR
|
||||
: -RI_SCROLLWHEEL_PANFACTOR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -204,11 +204,12 @@ public:
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void cleanupBeforeClose();
|
||||
void detachAllPlotItems();
|
||||
void calculateXZoomRange();
|
||||
@ -272,6 +273,8 @@ private:
|
||||
|
||||
RimWellLogPlot* parentWellLogPlot() const;
|
||||
|
||||
void handleWheelEvent( QWheelEvent* event ) override;
|
||||
|
||||
private:
|
||||
QString m_xAxisTitle;
|
||||
|
||||
|
@ -87,4 +87,8 @@ list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.h
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\Summary" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
@ -496,9 +496,9 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( curveMerger.allXValues().size() > 0 )
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( curveMerger.interpolatedYValuesForAllXValues( 0 ),
|
||||
curveMerger.interpolatedYValuesForAllXValues( 1 ),
|
||||
isLogCurve );
|
||||
this->setSamplesFromXYValues( curveMerger.interpolatedYValuesForAllXValues( 0 ),
|
||||
curveMerger.interpolatedYValuesForAllXValues( 1 ),
|
||||
isLogCurve );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -530,12 +530,12 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( timeSteps, curveValuesY, isLogCurve );
|
||||
this->setSamplesFromXYValues( timeSteps, curveValuesY, isLogCurve );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, isLogCurve );
|
||||
this->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, isLogCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -553,7 +553,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( timeFromSimulationStart, curveValuesY, isLogCurve );
|
||||
this->setSamplesFromXYValues( timeFromSimulationStart, curveValuesY, isLogCurve );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -564,7 +564,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( shouldPopulateViewWithEmptyData )
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( std::vector<double>(), std::vector<double>(), isLogCurve );
|
||||
this->setSamplesFromXYValues( std::vector<double>(), std::vector<double>(), isLogCurve );
|
||||
}
|
||||
|
||||
if ( updateParentPlot && m_parentQwtPlot )
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
@ -209,7 +209,6 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
m_summaryCurves_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
m_isCrossPlot = false;
|
||||
m_isDraggable = true;
|
||||
|
||||
m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper );
|
||||
|
||||
@ -543,6 +542,14 @@ void RimSummaryPlot::updatePlotTitle()
|
||||
|
||||
updateCurveNames();
|
||||
updateMdiWindowTitle();
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
QString plotTitle = description();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1336,11 +1343,6 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showWindow )
|
||||
{
|
||||
updateWindowVisibility();
|
||||
}
|
||||
|
||||
if ( changedField == &m_showPlotTitle || changedField == &m_description || changedField == &m_useAutoPlotTitle )
|
||||
{
|
||||
updatePlotTitle();
|
||||
@ -1425,8 +1427,7 @@ void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updatePlotTitle();
|
||||
|
||||
updateWindowVisibility();
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( m_summaryCurveCollection )
|
||||
{
|
||||
@ -1567,14 +1568,6 @@ QString RimSummaryPlot::description() const
|
||||
return m_description();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setDraggable( bool draggable )
|
||||
{
|
||||
m_isDraggable = draggable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1599,6 +1592,16 @@ void RimSummaryPlot::setAsCrossPlot()
|
||||
m_isCrossPlot = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::onPlotZoomed()
|
||||
{
|
||||
setAutoScaleXEnabled( false );
|
||||
setAutoScaleYEnabled( false );
|
||||
updateZoomFromQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1648,12 +1651,11 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimSummaryPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
RiuQwtPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
m_plotWidget = new RiuSummaryQwtPlot( this, mainWindowParent );
|
||||
m_plotWidget->setDraggable( m_isDraggable );
|
||||
|
||||
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
|
||||
{
|
||||
@ -1674,6 +1676,10 @@ QWidget* RimSummaryPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_ensembleCurveSetCollection->setParentQwtPlotAndReplot( m_plotWidget );
|
||||
}
|
||||
|
||||
this->connect( m_plotWidget, SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) );
|
||||
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
return m_plotWidget;
|
||||
@ -1735,36 +1741,6 @@ void RimSummaryPlot::initAfterRead()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateMdiWindowTitle()
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
QString plotTitle = description();
|
||||
|
||||
m_plotWidget->setWindowTitle( plotTitle );
|
||||
|
||||
if ( m_showPlotTitle )
|
||||
{
|
||||
m_plotWidget->setTitle( plotTitle );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->setTitle( "" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->setTitle( "" );
|
||||
}
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1817,22 +1793,6 @@ void RimSummaryPlot::updateNameHelperWithCurveData( RimSummaryPlotNameHelper* na
|
||||
nameHelper->setEnsembleCases( ensembleCases );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateWindowVisibility()
|
||||
{
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -65,6 +65,7 @@ class QKeyEvent;
|
||||
//==================================================================================================
|
||||
class RimSummaryPlot : public RimPlot
|
||||
{
|
||||
Q_OBJECT;
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
@ -76,8 +77,6 @@ public:
|
||||
void setDescription( const QString& description );
|
||||
QString description() const override;
|
||||
|
||||
void setDraggable( bool draggable );
|
||||
|
||||
void enableAutoPlotTitle( bool enable );
|
||||
bool autoPlotTitle() const;
|
||||
|
||||
@ -155,7 +154,6 @@ public:
|
||||
void setNormalizationEnabled( bool enable );
|
||||
bool isNormalizationEnabled();
|
||||
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent );
|
||||
virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const;
|
||||
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
@ -172,20 +170,20 @@ public:
|
||||
|
||||
public:
|
||||
// RimViewWindow overrides
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
void deleteViewWidget() override;
|
||||
void initAfterRead() override;
|
||||
void deleteViewWidget() override;
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void updateMdiWindowTitle() override;
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void updateNameHelperWithCurveData( RimSummaryPlotNameHelper* nameHelper ) const;
|
||||
|
||||
void updateWindowVisibility();
|
||||
void doUpdateLayout() override;
|
||||
|
||||
void detachAllPlotItems();
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
@ -201,6 +199,9 @@ protected:
|
||||
|
||||
void setAsCrossPlot();
|
||||
|
||||
private slots:
|
||||
void onPlotZoomed();
|
||||
|
||||
private:
|
||||
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
||||
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
||||
@ -244,7 +245,6 @@ private:
|
||||
std::unique_ptr<QwtPlotTextLabel> m_plotInfoLabel;
|
||||
|
||||
bool m_isCrossPlot;
|
||||
bool m_isDraggable;
|
||||
|
||||
std::unique_ptr<RimSummaryPlotNameHelper> m_nameHelperAllCurves;
|
||||
|
||||
|
@ -52,10 +52,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuCellAndNncPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.h
|
||||
@ -148,7 +146,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.cpp
|
||||
@ -213,9 +211,8 @@ ${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}/RiuMultiPlotInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuRecentFileActionProvider.h
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimMimeData.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
@ -186,7 +186,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if ( dynamic_cast<RimMultiPlotWindow*>( uiItem ) )
|
||||
else if ( dynamic_cast<RimMultiPlot*>( uiItem ) )
|
||||
{
|
||||
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
@ -297,14 +297,7 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in
|
||||
return handleWellLogPlotCurveDrop( action, draggedObjects, wellLogPlotCurve );
|
||||
}
|
||||
|
||||
RimWellLogTrack* wellLogPlotTrack;
|
||||
dropTarget->firstAncestorOrThisOfType( wellLogPlotTrack );
|
||||
if ( wellLogPlotTrack )
|
||||
{
|
||||
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack, row );
|
||||
}
|
||||
|
||||
RimMultiPlotWindow* multiPlot;
|
||||
RimMultiPlot* multiPlot;
|
||||
dropTarget->firstAncestorOrThisOfType( multiPlot );
|
||||
if ( multiPlot )
|
||||
{
|
||||
@ -396,67 +389,12 @@ bool RiuDragDrop::handleGridCaseGroupDrop( Qt::DropAction action,
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimWellLogTrack* trackTarget,
|
||||
int insertAtPosition )
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> wellLogFileChannels =
|
||||
RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup( draggedObjects );
|
||||
if ( wellLogFileChannels.size() > 0 )
|
||||
{
|
||||
if ( action == Qt::CopyAction )
|
||||
{
|
||||
RicWellLogTools::addWellLogChannelsToPlotTrack( trackTarget, wellLogFileChannels );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogPlotCurves.size() > 0 )
|
||||
{
|
||||
if ( action == Qt::MoveAction )
|
||||
{
|
||||
RimWellLogCurve* insertAfter = nullptr;
|
||||
if ( insertAtPosition > 0 )
|
||||
{
|
||||
auto visibleCurves = trackTarget->visibleCurves();
|
||||
if ( !visibleCurves.empty() )
|
||||
{
|
||||
int insertAfterPosition = std::min( insertAtPosition - 1, (int)visibleCurves.size() - 1 );
|
||||
insertAfter = visibleCurves[insertAfterPosition];
|
||||
}
|
||||
}
|
||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( trackTarget, wellLogPlotCurves, insertAfter );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogPlotTracks.size() > 0 )
|
||||
{
|
||||
if ( action == Qt::MoveAction )
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
trackTarget->firstAncestorOrThisOfType( wellLogPlot );
|
||||
return handleMultiPlotDrop( action, draggedObjects, wellLogPlot, insertAtPosition );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleMultiPlotDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimMultiPlotWindow* multiPlot,
|
||||
RimMultiPlot* multiPlot,
|
||||
int insertAtPosition )
|
||||
{
|
||||
std::vector<RimPlot*> plots = RiuTypedPdmObjects<RimPlot>::typedObjectsFromGroup( draggedObjects );
|
||||
|
@ -29,7 +29,7 @@ namespace caf
|
||||
class PdmObjectHandle;
|
||||
}
|
||||
|
||||
class RimMultiPlotWindow;
|
||||
class RimMultiPlot;
|
||||
class RimIdenticalGridCaseGroup;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimSummaryCaseMainCollection;
|
||||
@ -67,7 +67,7 @@ private:
|
||||
int insertAtPosition );
|
||||
bool handleMultiPlotDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& objectGroup,
|
||||
RimMultiPlotWindow* multiPlot,
|
||||
RimMultiPlot* multiPlot,
|
||||
int insertAtPosition );
|
||||
bool handleWellLogPlotCurveDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& objectGroup,
|
||||
|
@ -58,8 +58,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimPlot* plotDefinition, QWidget* parent /*= nullptr*/ )
|
||||
: RiuQwtPlotWidget( plotDefinition, parent )
|
||||
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* parent /*= nullptr*/ )
|
||||
: RiuQwtPlotWidget( plot, parent )
|
||||
{
|
||||
// LeftButton for the zooming
|
||||
m_zoomerLeft = new RiuQwtPlotZoomer( canvas() );
|
||||
@ -132,14 +132,6 @@ void RiuGridCrossQwtPlot::updateAnnotationObjects( RimPlotAxisProperties* axisPr
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiuGridCrossQwtPlot::ownerViewWindow() const
|
||||
{
|
||||
return dynamic_cast<RimViewWindow*>( plotDefinition() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -182,7 +174,7 @@ void RiuGridCrossQwtPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem( ownerViewWindow() );
|
||||
emit plotSelected( false );
|
||||
|
||||
menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature";
|
||||
menuBuilder << "Separator";
|
||||
@ -281,5 +273,5 @@ void RiuGridCrossQwtPlot::endZoomOperations()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridCrossQwtPlot::onZoomedSlot()
|
||||
{
|
||||
plotDefinition()->updateZoomFromQwt();
|
||||
emit plotZoomed();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RimGridCrossPlot;
|
||||
class RimGridCrossPlotDataSet;
|
||||
class RimPlotAxisProperties;
|
||||
class RimPlot;
|
||||
@ -45,23 +46,24 @@ class TitledOverlayFrame;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuGridCrossQwtPlot : public RiuQwtPlotWidget, public RiuInterfaceToViewWindow
|
||||
class RiuGridCrossQwtPlot : public RiuQwtPlotWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
RiuGridCrossQwtPlot( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
||||
RiuGridCrossQwtPlot( RimGridCrossPlot* crossPlot, QWidget* parent = nullptr );
|
||||
~RiuGridCrossQwtPlot();
|
||||
|
||||
RiuGridCrossQwtPlot( const RiuGridCrossQwtPlot& ) = delete;
|
||||
|
||||
void updateAnnotationObjects( RimPlotAxisProperties* axisProperties );
|
||||
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
|
||||
void setLegendFontSize( int fontSize );
|
||||
void setInternalQwtLegendVisible( bool visible );
|
||||
|
||||
signals:
|
||||
void plotZoomed();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
|
||||
|
@ -15,14 +15,14 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuMultiPlotBook.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@ -98,16 +98,14 @@ private:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent )
|
||||
: RiuMultiPlotInterface( parent )
|
||||
RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_plotDefinition( plotDefinition )
|
||||
, m_plotTitle( "Multi Plot" )
|
||||
, m_titleVisible( true )
|
||||
, m_subTitlesVisible( true )
|
||||
, m_previewMode( true )
|
||||
{
|
||||
Q_ASSERT( plotDefinition );
|
||||
m_plotDefinition = plotDefinition;
|
||||
|
||||
const int spacing = 8;
|
||||
|
||||
this->setBackgroundRole( QPalette::Dark );
|
||||
@ -147,12 +145,12 @@ RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWid
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMultiPlotWindow::~RiuMultiPlotWindow() {}
|
||||
RiuMultiPlotBook::~RiuMultiPlotBook() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow* RiuMultiPlotWindow::ownerPlotDefinition()
|
||||
RimViewWindow* RiuMultiPlotBook::ownerViewWindow() const
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
@ -160,15 +158,7 @@ RimMultiPlotWindow* RiuMultiPlotWindow::ownerPlotDefinition()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiuMultiPlotWindow::ownerViewWindow() const
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::addPlot( RiuQwtPlotWidget* plotWidget )
|
||||
void RiuMultiPlotBook::addPlot( RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
// Push the plot to the back of the list
|
||||
insertPlot( plotWidget, m_plotWidgets.size() );
|
||||
@ -177,9 +167,8 @@ void RiuMultiPlotWindow::addPlot( RiuQwtPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
|
||||
void RiuMultiPlotBook::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 );
|
||||
scheduleUpdate();
|
||||
}
|
||||
@ -187,7 +176,7 @@ void RiuMultiPlotWindow::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::removePlot( RiuQwtPlotWidget* plotWidget )
|
||||
void RiuMultiPlotBook::removePlot( RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
if ( !plotWidget ) return;
|
||||
|
||||
@ -202,7 +191,7 @@ void RiuMultiPlotWindow::removePlot( RiuQwtPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::setPlotTitle( const QString& plotTitle )
|
||||
void RiuMultiPlotBook::setPlotTitle( const QString& plotTitle )
|
||||
{
|
||||
m_plotTitle = plotTitle;
|
||||
for ( int i = 0; i < m_pages.size(); ++i )
|
||||
@ -214,7 +203,7 @@ void RiuMultiPlotWindow::setPlotTitle( const QString& plotTitle )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::setTitleVisible( bool visible )
|
||||
void RiuMultiPlotBook::setTitleVisible( bool visible )
|
||||
{
|
||||
m_titleVisible = visible;
|
||||
for ( auto page : m_pages )
|
||||
@ -226,25 +215,19 @@ void RiuMultiPlotWindow::setTitleVisible( bool visible )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::setSelectionsVisible( bool visible )
|
||||
void RiuMultiPlotBook::setSubTitlesVisible( bool visible )
|
||||
{
|
||||
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
|
||||
m_subTitlesVisible = visible;
|
||||
for ( auto page : m_pages )
|
||||
{
|
||||
if ( visible && caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), 0 ) )
|
||||
{
|
||||
plotWidget->setWidgetState( "selected" );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( plotWidget );
|
||||
}
|
||||
page->setSubTitlesVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::setFontSize( int fontSize )
|
||||
void RiuMultiPlotBook::setFontSize( int fontSize )
|
||||
{
|
||||
QFont font = this->font();
|
||||
int pixelSize = RiaFontCache::pointSizeToPixelSize( fontSize );
|
||||
@ -256,14 +239,12 @@ void RiuMultiPlotWindow::setFontSize( int fontSize )
|
||||
{
|
||||
page->setFontSize( fontSize );
|
||||
}
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuMultiPlotWindow::fontSize() const
|
||||
int RiuMultiPlotBook::fontSize() const
|
||||
{
|
||||
return RiaFontCache::pixelSizeToPointSize( this->font().pixelSize() );
|
||||
}
|
||||
@ -271,7 +252,7 @@ int RiuMultiPlotWindow::fontSize() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuMultiPlotWindow::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
|
||||
int RiuMultiPlotBook::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
return m_plotWidgets.indexOf( plotWidget );
|
||||
}
|
||||
@ -279,7 +260,7 @@ int RiuMultiPlotWindow::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuMultiPlotWindow::previewModeEnabled() const
|
||||
bool RiuMultiPlotBook::previewModeEnabled() const
|
||||
{
|
||||
return m_previewMode;
|
||||
}
|
||||
@ -287,7 +268,7 @@ bool RiuMultiPlotWindow::previewModeEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::setPreviewModeEnabled( bool previewMode )
|
||||
void RiuMultiPlotBook::setPreviewModeEnabled( bool previewMode )
|
||||
{
|
||||
m_previewMode = previewMode;
|
||||
|
||||
@ -295,14 +276,12 @@ void RiuMultiPlotWindow::setPreviewModeEnabled( bool previewMode )
|
||||
{
|
||||
page->setPreviewModeEnabled( previewModeEnabled() );
|
||||
}
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::scheduleUpdate()
|
||||
void RiuMultiPlotBook::scheduleUpdate()
|
||||
{
|
||||
RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotWindowUpdate( this );
|
||||
}
|
||||
@ -310,7 +289,7 @@ void RiuMultiPlotWindow::scheduleUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::scheduleReplotOfAllPlots()
|
||||
void RiuMultiPlotBook::scheduleReplotOfAllPlots()
|
||||
{
|
||||
for ( RiuQwtPlotWidget* plotWidget : visiblePlotWidgets() )
|
||||
{
|
||||
@ -321,9 +300,12 @@ void RiuMultiPlotWindow::scheduleReplotOfAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::renderTo( QPaintDevice* paintDevice )
|
||||
void RiuMultiPlotBook::renderTo( QPaintDevice* paintDevice )
|
||||
{
|
||||
setSelectionsVisible( false );
|
||||
for ( auto page : m_pages )
|
||||
{
|
||||
page->stashWidgetStates();
|
||||
}
|
||||
|
||||
int resolution = paintDevice->logicalDpiX();
|
||||
double scaling = resolution / static_cast<double>( RiaGuiApplication::applicationResolution() );
|
||||
@ -344,18 +326,21 @@ void RiuMultiPlotWindow::renderTo( QPaintDevice* paintDevice )
|
||||
firstPage = false;
|
||||
}
|
||||
|
||||
setSelectionsVisible( true );
|
||||
for ( auto page : m_pages )
|
||||
{
|
||||
page->restoreWidgetStates();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::contextMenuEvent( QContextMenuEvent* event )
|
||||
void RiuMultiPlotBook::contextMenuEvent( QContextMenuEvent* event )
|
||||
{
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem( ownerPlotDefinition() );
|
||||
caf::SelectionManager::instance()->setSelectedItem( ownerViewWindow() );
|
||||
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
@ -371,7 +356,7 @@ void RiuMultiPlotWindow::contextMenuEvent( QContextMenuEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::showEvent( QShowEvent* event )
|
||||
void RiuMultiPlotBook::showEvent( QShowEvent* event )
|
||||
{
|
||||
QWidget::showEvent( event );
|
||||
performUpdate();
|
||||
@ -381,7 +366,7 @@ void RiuMultiPlotWindow::showEvent( QShowEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::resizeEvent( QResizeEvent* event )
|
||||
void RiuMultiPlotBook::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
setBookSize( event->size().width() );
|
||||
QWidget::resizeEvent( event );
|
||||
@ -390,7 +375,7 @@ void RiuMultiPlotWindow::resizeEvent( QResizeEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::setBookSize( int frameWidth )
|
||||
void RiuMultiPlotBook::setBookSize( int frameWidth )
|
||||
{
|
||||
for ( auto page : m_pages )
|
||||
{
|
||||
@ -404,7 +389,7 @@ void RiuMultiPlotWindow::setBookSize( int frameWidth )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, int> RiuMultiPlotWindow::rowAndColumnCount( int plotWidgetCount ) const
|
||||
std::pair<int, int> RiuMultiPlotBook::rowAndColumnCount( int plotWidgetCount ) const
|
||||
{
|
||||
if ( plotWidgetCount == 0 )
|
||||
{
|
||||
@ -419,7 +404,7 @@ std::pair<int, int> RiuMultiPlotWindow::rowAndColumnCount( int plotWidgetCount )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuMultiPlotWindow::showYAxis( int row, int column ) const
|
||||
bool RiuMultiPlotBook::showYAxis( int row, int column ) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -427,7 +412,7 @@ bool RiuMultiPlotWindow::showYAxis( int row, int column ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::performUpdate()
|
||||
void RiuMultiPlotBook::performUpdate()
|
||||
{
|
||||
deleteAllPages();
|
||||
createPages();
|
||||
@ -437,7 +422,7 @@ void RiuMultiPlotWindow::performUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<QPointer<RiuQwtPlotWidget>> RiuMultiPlotWindow::visiblePlotWidgets() const
|
||||
QList<QPointer<RiuQwtPlotWidget>> RiuMultiPlotBook::visiblePlotWidgets() const
|
||||
{
|
||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets;
|
||||
for ( QPointer<RiuQwtPlotWidget> plotWidget : m_plotWidgets )
|
||||
@ -453,7 +438,7 @@ QList<QPointer<RiuQwtPlotWidget>> RiuMultiPlotWindow::visiblePlotWidgets() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::deleteAllPages()
|
||||
void RiuMultiPlotBook::deleteAllPages()
|
||||
{
|
||||
for ( RiuMultiPlotPage* page : m_pages )
|
||||
{
|
||||
@ -467,8 +452,10 @@ void RiuMultiPlotWindow::deleteAllPages()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotWindow::createPages()
|
||||
void RiuMultiPlotBook::createPages()
|
||||
{
|
||||
CAF_ASSERT( m_plotDefinition );
|
||||
|
||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
||||
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
||||
|
||||
@ -476,41 +463,53 @@ void RiuMultiPlotWindow::createPages()
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
|
||||
RiuMultiPlotPage* page = new RiuMultiPlotPage( m_plotDefinition, this );
|
||||
m_pages.push_back( page );
|
||||
m_bookLayout->addWidget( page );
|
||||
// Make sure we always add a page. For empty multi-plots we'll have an empty page with a drop target.
|
||||
RiuMultiPlotPage* page = createPage();
|
||||
|
||||
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
||||
{
|
||||
int expextedColSpan = static_cast<int>( plotWidgets[visibleIndex]->plotDefinition()->colSpan() );
|
||||
int expextedColSpan = static_cast<int>( plotWidgets[visibleIndex]->colSpan() );
|
||||
int colSpan = std::min( expextedColSpan, rowAndColumnCount.second );
|
||||
|
||||
std::tie( row, column ) = page->findAvailableRowAndColumn( row, column, colSpan, rowAndColumnCount.second );
|
||||
if ( row >= rowsPerPage )
|
||||
{
|
||||
page = new RiuMultiPlotPage( m_plotDefinition, this );
|
||||
|
||||
m_pages.push_back( page );
|
||||
m_bookLayout->addWidget( page );
|
||||
page = createPage();
|
||||
row = 0;
|
||||
column = 0;
|
||||
}
|
||||
page->addPlot( plotWidgets[visibleIndex] );
|
||||
page->setVisible( true );
|
||||
page->performUpdate();
|
||||
}
|
||||
// Reapply plot settings
|
||||
setPlotTitle( m_plotTitle );
|
||||
|
||||
setFontSize( RiaApplication::instance()->preferences()->defaultPlotFontSize() );
|
||||
setTitleVisible( m_titleVisible );
|
||||
setPreviewModeEnabled( m_previewMode );
|
||||
m_book->adjustSize();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QList<QPointer<RiuMultiPlotPage>>& RiuMultiPlotWindow::pages() const
|
||||
const QList<QPointer<RiuMultiPlotPage>>& RiuMultiPlotBook::pages() const
|
||||
{
|
||||
return m_pages;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMultiPlotPage* RiuMultiPlotBook::createPage()
|
||||
{
|
||||
RiuMultiPlotPage* page = new RiuMultiPlotPage( m_plotDefinition, this );
|
||||
|
||||
// Reapply plot settings
|
||||
size_t pageNumber = m_pages.size() + 1;
|
||||
page->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( pageNumber ) );
|
||||
page->setFontSize( RiaApplication::instance()->preferences()->defaultPlotFontSize() );
|
||||
page->setTitleVisible( m_titleVisible );
|
||||
page->setSubTitlesVisible( m_subTitlesVisible );
|
||||
page->setPreviewModeEnabled( m_previewMode );
|
||||
|
||||
m_pages.push_back( page );
|
||||
m_bookLayout->addWidget( page );
|
||||
|
||||
page->setVisible( true );
|
||||
return page;
|
||||
}
|
@ -18,8 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiuInterfaceToViewWindow.h"
|
||||
#include "RiuMultiPlotInterface.h"
|
||||
|
||||
#include "RiuMultiPlotPage.h"
|
||||
#include "cafUiStyleSheet.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
@ -35,7 +34,7 @@
|
||||
#include <map>
|
||||
|
||||
class RiaPlotWindowRedrawScheduler;
|
||||
class RimMultiPlotWindow;
|
||||
class RimMultiPlot;
|
||||
class RiuMultiPlotPage;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
@ -49,42 +48,43 @@ class QwtPlot;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// RiuMultiPlotWidget
|
||||
// RiuMultiPlotWindow
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuMultiPlotWindow : public RiuMultiPlotInterface, public RiuInterfaceToViewWindow
|
||||
class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent = nullptr );
|
||||
~RiuMultiPlotWindow() override;
|
||||
using ColumnCount = RiuMultiPlotPage::ColumnCount;
|
||||
|
||||
RimMultiPlotWindow* ownerPlotDefinition();
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
public:
|
||||
RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* parent = nullptr );
|
||||
~RiuMultiPlotBook() override;
|
||||
|
||||
void addPlot( RiuQwtPlotWidget* plotWidget ) override;
|
||||
void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) override;
|
||||
void removePlot( RiuQwtPlotWidget* plotWidget ) override;
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
|
||||
void setPlotTitle( const QString& plotTitle ) override;
|
||||
void addPlot( RiuQwtPlotWidget* plotWidget );
|
||||
void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index );
|
||||
void removePlot( RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
void setTitleVisible( bool visible ) override;
|
||||
void setSelectionsVisible( bool visible );
|
||||
void setPlotTitle( const QString& plotTitle );
|
||||
|
||||
void setTitleVisible( bool visible );
|
||||
void setSubTitlesVisible( bool visible );
|
||||
|
||||
void setFontSize( int fontSize );
|
||||
int fontSize() const;
|
||||
|
||||
int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
bool previewModeEnabled() const override;
|
||||
void setPreviewModeEnabled( bool previewMode ) override;
|
||||
bool previewModeEnabled() const;
|
||||
void setPreviewModeEnabled( bool previewMode );
|
||||
|
||||
void scheduleUpdate();
|
||||
void scheduleReplotOfAllPlots();
|
||||
void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) override {}
|
||||
|
||||
void renderTo( QPaintDevice* painter ) override;
|
||||
void renderTo( QPaintDevice* painter );
|
||||
|
||||
protected:
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
@ -104,6 +104,7 @@ private:
|
||||
void deleteAllPages();
|
||||
void createPages();
|
||||
const QList<QPointer<RiuMultiPlotPage>>& pages() const;
|
||||
RiuMultiPlotPage* createPage();
|
||||
|
||||
private slots:
|
||||
virtual void performUpdate();
|
||||
@ -116,10 +117,11 @@ protected:
|
||||
QPointer<BookFrame> m_book;
|
||||
QPointer<QVBoxLayout> m_bookLayout;
|
||||
|
||||
QList<QPointer<RiuMultiPlotPage>> m_pages;
|
||||
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
|
||||
caf::PdmPointer<RimMultiPlotWindow> m_plotDefinition;
|
||||
QString m_plotTitle;
|
||||
bool m_titleVisible;
|
||||
bool m_previewMode;
|
||||
QList<QPointer<RiuMultiPlotPage>> m_pages;
|
||||
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
|
||||
caf::PdmPointer<RimMultiPlot> m_plotDefinition;
|
||||
QString m_plotTitle;
|
||||
bool m_titleVisible;
|
||||
bool m_subTitlesVisible;
|
||||
bool m_previewMode;
|
||||
};
|
@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 <QWidget>
|
||||
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
class QPaintDevice;
|
||||
class QScrollBar;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// RiuMultiPlotInterface
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuMultiPlotInterface : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuMultiPlotInterface( QWidget* parent = nullptr )
|
||||
: QWidget( parent )
|
||||
{
|
||||
}
|
||||
virtual ~RiuMultiPlotInterface() {}
|
||||
|
||||
virtual void addPlot( RiuQwtPlotWidget* plotWidget ) = 0;
|
||||
virtual void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) = 0;
|
||||
virtual void removePlot( RiuQwtPlotWidget* plotWidget ) = 0;
|
||||
virtual int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ) = 0;
|
||||
|
||||
virtual void setPlotTitle( const QString& plotTitle ) = 0;
|
||||
virtual void setTitleVisible( bool visible ) = 0;
|
||||
virtual void setFontSize( int fontSize ) = 0;
|
||||
virtual int fontSize() const = 0;
|
||||
|
||||
virtual bool previewModeEnabled() const = 0;
|
||||
virtual void setPreviewModeEnabled( bool previewMode ) = 0;
|
||||
|
||||
virtual void scheduleUpdate() = 0;
|
||||
virtual void scheduleReplotOfAllPlots() = 0;
|
||||
virtual void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) = 0;
|
||||
|
||||
virtual void renderTo( QPaintDevice* paintDevice ) = 0;
|
||||
};
|
@ -28,7 +28,7 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@ -63,13 +63,13 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMultiPlotPage::RiuMultiPlotPage( RimMultiPlotWindow* plotDefinition, QWidget* parent )
|
||||
: RiuMultiPlotInterface( parent )
|
||||
RiuMultiPlotPage::RiuMultiPlotPage( RimPlotWindow* plotDefinition, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_plotDefinition( plotDefinition )
|
||||
, m_previewMode( false )
|
||||
, m_showSubTitles( false )
|
||||
{
|
||||
Q_ASSERT( plotDefinition );
|
||||
m_plotDefinition = plotDefinition;
|
||||
CAF_ASSERT( m_plotDefinition );
|
||||
|
||||
m_layout = new QVBoxLayout( this );
|
||||
m_layout->setMargin( 0 );
|
||||
@ -77,7 +77,7 @@ RiuMultiPlotPage::RiuMultiPlotPage( RimMultiPlotWindow* plotDefinition, QWidget*
|
||||
|
||||
m_plotTitle = createTitleLabel();
|
||||
m_layout->addWidget( m_plotTitle );
|
||||
m_plotTitle->setVisible( m_plotDefinition->isMultiPlotTitleVisible() );
|
||||
m_plotTitle->setVisible( true );
|
||||
|
||||
m_plotLayout = new QHBoxLayout;
|
||||
m_layout->addLayout( m_plotLayout );
|
||||
@ -98,19 +98,10 @@ RiuMultiPlotPage::RiuMultiPlotPage( RimMultiPlotWindow* plotDefinition, QWidget*
|
||||
|
||||
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
|
||||
|
||||
m_dropTargetPlaceHolder = new QLabel( "Drag plots here" );
|
||||
m_dropTargetPlaceHolder->setAlignment( Qt::AlignCenter );
|
||||
m_dropTargetPlaceHolder->setObjectName(
|
||||
QString( "%1" ).arg( reinterpret_cast<uint64_t>( m_dropTargetPlaceHolder.data() ) ) );
|
||||
m_dropTargetStyleSheet = createDropTargetStyleSheet();
|
||||
m_dropTargetStyleSheet.applyToWidget( m_dropTargetPlaceHolder );
|
||||
|
||||
this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
|
||||
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
|
||||
setAcceptDrops( m_plotDefinition->acceptDrops() );
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
int defaultFontSize = app->preferences()->defaultPlotFontSize();
|
||||
setFontSize( defaultFontSize );
|
||||
@ -136,7 +127,15 @@ RiuMultiPlotPage::~RiuMultiPlotPage() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow* RiuMultiPlotPage::ownerPlotDefinition()
|
||||
RimViewWindow* RiuMultiPlotPage::ownerViewWindow() const
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotWindow* RiuMultiPlotPage::ownerPlotDefinition()
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
@ -155,11 +154,11 @@ void RiuMultiPlotPage::addPlot( RiuQwtPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::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 );
|
||||
plotWidget->setVisible( false );
|
||||
|
||||
QLabel* subTitle = new QLabel( plotWidget->plotDefinition()->description() );
|
||||
QString subTitleText = plotWidget->plotTitle();
|
||||
QLabel* subTitle = new QLabel( subTitleText );
|
||||
subTitle->setAlignment( Qt::AlignHCenter );
|
||||
subTitle->setVisible( false );
|
||||
m_subTitles.insert( static_cast<int>( index ), subTitle );
|
||||
@ -240,24 +239,6 @@ void RiuMultiPlotPage::setTitleVisible( bool visible )
|
||||
m_plotTitle->setVisible( visible );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::setSelectionsVisible( bool visible )
|
||||
{
|
||||
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
|
||||
{
|
||||
if ( visible && caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), 0 ) )
|
||||
{
|
||||
plotWidget->setWidgetState( "selected" );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( plotWidget );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -289,6 +270,14 @@ int RiuMultiPlotPage::fontSize() const
|
||||
return m_plotTitle->font().pointSize() - 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::setSubTitlesVisible( bool visible )
|
||||
{
|
||||
m_showSubTitles = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -318,6 +307,7 @@ int RiuMultiPlotPage::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::scheduleUpdate()
|
||||
{
|
||||
CAF_ASSERT( m_plotDefinition );
|
||||
RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotPageUpdate( this );
|
||||
}
|
||||
|
||||
@ -349,7 +339,7 @@ void RiuMultiPlotPage::renderTo( QPaintDevice* paintDevice )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::renderTo( QPainter* painter, double scalingFactor )
|
||||
{
|
||||
setSelectionsVisible( false );
|
||||
stashWidgetStates();
|
||||
painter->fillRect( painter->viewport(), Qt::white );
|
||||
m_plotTitle->render( painter );
|
||||
|
||||
@ -381,7 +371,7 @@ void RiuMultiPlotPage::renderTo( QPainter* painter, double scalingFactor )
|
||||
plotWidget->renderTo( painter, plotWidgetGeometry, scalingFactor );
|
||||
}
|
||||
|
||||
setSelectionsVisible( true );
|
||||
restoreWidgetStates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -410,7 +400,7 @@ void RiuMultiPlotPage::contextMenuEvent( QContextMenuEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QLabel* RiuMultiPlotPage::createTitleLabel() const
|
||||
{
|
||||
QLabel* plotTitle = new QLabel( "PLOT TITLE HERE", nullptr );
|
||||
QLabel* plotTitle = new QLabel( "", nullptr );
|
||||
plotTitle->setAlignment( Qt::AlignHCenter );
|
||||
plotTitle->setWordWrap( true );
|
||||
plotTitle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
|
||||
@ -423,128 +413,7 @@ QLabel* RiuMultiPlotPage::createTitleLabel() const
|
||||
void RiuMultiPlotPage::showEvent( QShowEvent* event )
|
||||
{
|
||||
QWidget::showEvent( event );
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::dragEnterEvent( QDragEnterEvent* event )
|
||||
{
|
||||
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
|
||||
if ( source )
|
||||
{
|
||||
setWidgetState( "dragTargetInto" );
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::dragMoveEvent( QDragMoveEvent* event )
|
||||
{
|
||||
if ( event->answerRect().intersects( this->geometry() ) )
|
||||
{
|
||||
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
|
||||
if ( source && willAcceptDroppedPlot( source ) )
|
||||
{
|
||||
setWidgetState( "dragTargetInto" );
|
||||
|
||||
QRect originalGeometry = source->geometry();
|
||||
QPoint offset = source->dragStartPosition();
|
||||
QRect newRect( event->pos() - offset, originalGeometry.size() );
|
||||
|
||||
QList<QPointer<RiuQwtPlotWidget>> visiblePlotWidgets = this->visiblePlotWidgets();
|
||||
|
||||
int insertBeforeIndex = visiblePlotWidgets.size();
|
||||
for ( int visibleIndex = 0; visibleIndex < visiblePlotWidgets.size(); ++visibleIndex )
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( visiblePlotWidgets[visibleIndex] );
|
||||
|
||||
if ( visiblePlotWidgets[visibleIndex]->frameIsInFrontOfThis( newRect ) )
|
||||
{
|
||||
insertBeforeIndex = std::min( insertBeforeIndex, visibleIndex );
|
||||
}
|
||||
}
|
||||
if ( insertBeforeIndex >= 0 && insertBeforeIndex < visiblePlotWidgets.size() )
|
||||
{
|
||||
visiblePlotWidgets[insertBeforeIndex]->setWidgetState( "dragTargetBefore" );
|
||||
}
|
||||
|
||||
if ( insertBeforeIndex > 0 )
|
||||
{
|
||||
int insertAfterIndex = insertBeforeIndex - 1;
|
||||
visiblePlotWidgets[insertAfterIndex]->setWidgetState( "dragTargetAfter" );
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::dragLeaveEvent( QDragLeaveEvent* event )
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( this );
|
||||
|
||||
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( m_plotWidgets[tIdx] );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::dropEvent( QDropEvent* event )
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( this );
|
||||
|
||||
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
|
||||
{
|
||||
caf::UiStyleSheet::clearWidgetStates( m_plotWidgets[tIdx] );
|
||||
}
|
||||
|
||||
if ( this->geometry().contains( event->pos() ) )
|
||||
{
|
||||
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
|
||||
|
||||
if ( source && willAcceptDroppedPlot( source ) )
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
|
||||
QRect originalGeometry = source->geometry();
|
||||
QPoint offset = source->dragStartPosition();
|
||||
QRect newRect( event->pos() - offset, originalGeometry.size() );
|
||||
|
||||
int beforeIndex = m_plotWidgets.size();
|
||||
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
|
||||
{
|
||||
if ( m_plotWidgets[tIdx]->isVisible() )
|
||||
{
|
||||
if ( m_plotWidgets[tIdx]->frameIsInFrontOfThis( newRect ) )
|
||||
{
|
||||
beforeIndex = tIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
RimPlot* insertAfter = nullptr;
|
||||
if ( beforeIndex > 0 )
|
||||
{
|
||||
insertAfter = m_plotWidgets[beforeIndex - 1]->plotDefinition();
|
||||
}
|
||||
|
||||
RimPlot* plotToMove = source->plotDefinition();
|
||||
|
||||
if ( insertAfter != plotToMove )
|
||||
{
|
||||
m_plotDefinition->movePlotsToThis( {plotToMove}, insertAfter );
|
||||
}
|
||||
}
|
||||
}
|
||||
performUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -590,13 +459,16 @@ void RiuMultiPlotPage::updateMarginsFromPageLayout()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuMultiPlotPage::sizeHint() const
|
||||
{
|
||||
QPageLayout pageLayout = m_plotDefinition->pageLayout();
|
||||
const int resolution = RiaGuiApplication::applicationResolution();
|
||||
QRect rect = pageLayout.fullRectPixels( resolution );
|
||||
QPageLayout pageLayout = RiaApplication::instance()->preferences()->defaultPageLayout();
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
pageLayout = m_plotDefinition->pageLayout();
|
||||
}
|
||||
|
||||
const int resolution = RiaGuiApplication::applicationResolution();
|
||||
QRect rect = pageLayout.fullRectPixels( resolution );
|
||||
return rect.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -606,14 +478,6 @@ QSize RiuMultiPlotPage::minimumSizeHint() const
|
||||
return QSize( fullSizeHint.width() / 2, fullSizeHint.height() / 2 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuMultiPlotPage::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -634,15 +498,18 @@ std::pair<int, int> RiuMultiPlotPage::rowAndColumnCount( int plotWidgetCount ) c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
|
||||
{
|
||||
if ( !m_plotDefinition ) return;
|
||||
|
||||
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
|
||||
{
|
||||
CAF_ASSERT( plotWidget );
|
||||
RimPlot* plot = plotWidget->plotDefinition();
|
||||
if ( !plot ) continue;
|
||||
|
||||
bool isSelected = false;
|
||||
for ( int changedLevel : changedSelectionLevels )
|
||||
{
|
||||
isSelected = isSelected ||
|
||||
caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), changedLevel );
|
||||
isSelected = isSelected || caf::SelectionManager::instance()->isSelected( plot, changedLevel );
|
||||
}
|
||||
if ( isSelected )
|
||||
{
|
||||
@ -655,14 +522,6 @@ void RiuMultiPlotPage::onSelectionManagerSelectionChanged( const std::set<int>&
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::setWidgetState( const QString& widgetState )
|
||||
{
|
||||
m_dropTargetStyleSheet.setWidgetState( m_dropTargetPlaceHolder, widgetState );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -716,25 +575,17 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
QList<QPointer<RiuQwtPlotLegend>> legends = this->legendsForVisiblePlots();
|
||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
||||
|
||||
if ( plotWidgets.empty() && acceptDrops() )
|
||||
if ( !plotWidgets.empty() )
|
||||
{
|
||||
m_gridLayout->addWidget( m_dropTargetPlaceHolder, 0, 0 );
|
||||
m_gridLayout->setRowStretch( 0, 1 );
|
||||
m_dropTargetPlaceHolder->setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dropTargetPlaceHolder->setVisible( false );
|
||||
|
||||
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
||||
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
||||
{
|
||||
int expextedColSpan = static_cast<int>( plotWidgets[visibleIndex]->plotDefinition()->colSpan() );
|
||||
int colSpan = std::min( expextedColSpan, rowAndColumnCount.second );
|
||||
int rowSpan = plotWidgets[visibleIndex]->plotDefinition()->rowSpan();
|
||||
int expectedColSpan = static_cast<int>( plotWidgets[visibleIndex]->colSpan() );
|
||||
int colSpan = std::min( expectedColSpan, rowAndColumnCount.second );
|
||||
int rowSpan = plotWidgets[visibleIndex]->rowSpan();
|
||||
|
||||
std::tie( row, column ) = findAvailableRowAndColumn( row, column, colSpan, rowAndColumnCount.second );
|
||||
|
||||
@ -743,7 +594,7 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
->addWidget( legends[visibleIndex], 3 * row + 1, column, 1, colSpan, Qt::AlignHCenter | Qt::AlignBottom );
|
||||
m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, column, 1 + ( rowSpan - 1 ) * 3, colSpan );
|
||||
|
||||
subTitles[visibleIndex]->setVisible( m_plotDefinition->showPlotTitles() );
|
||||
subTitles[visibleIndex]->setVisible( m_showSubTitles );
|
||||
|
||||
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, showYAxis( row, column ) );
|
||||
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, showYAxis( row, column ) );
|
||||
@ -775,7 +626,7 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
}
|
||||
for ( int c = column; c < column + colSpan; ++c )
|
||||
{
|
||||
int colStretch = 1;
|
||||
int colStretch = 6;
|
||||
if ( showYAxis( row, column ) ) colStretch += 1;
|
||||
m_gridLayout->setColumnStretch( c, std::max( colStretch, m_gridLayout->columnStretch( c ) ) );
|
||||
}
|
||||
@ -840,22 +691,6 @@ void RiuMultiPlotPage::clearGridLayout()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::UiStyleSheet RiuMultiPlotPage::createDropTargetStyleSheet()
|
||||
{
|
||||
caf::UiStyleSheet styleSheet;
|
||||
|
||||
styleSheet.set( "background-color", "white" );
|
||||
styleSheet.set( "border", "1px dashed black" );
|
||||
styleSheet.set( "font-size", "14pt" );
|
||||
styleSheet.property( "dragTargetInto" ).set( "border", "1px dashed lime" );
|
||||
styleSheet.property( "dragTargetInto" ).set( "background-color", "#DDFFDD" );
|
||||
|
||||
return styleSheet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -939,3 +774,25 @@ std::pair<int, int>
|
||||
}
|
||||
return std::make_pair( availableRow, availableColumn );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::stashWidgetStates()
|
||||
{
|
||||
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
|
||||
{
|
||||
plotWidget->stashWidgetStates();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::restoreWidgetStates()
|
||||
{
|
||||
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
|
||||
{
|
||||
plotWidget->restoreWidgetStates();
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RiuMultiPlotInterface.h"
|
||||
|
||||
#include "cafUiStyleSheet.h"
|
||||
#include "RiuInterfaceToViewWindow.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafSelectionChangedReceiver.h"
|
||||
#include "cafUiStyleSheet.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QGridLayout>
|
||||
@ -34,7 +33,7 @@
|
||||
#include <map>
|
||||
|
||||
class RiaPlotWindowRedrawScheduler;
|
||||
class RimMultiPlotWindow;
|
||||
class RimPlotWindow;
|
||||
class RiuQwtPlotLegend;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
@ -51,38 +50,48 @@ class QwtPlot;
|
||||
// RiuMultiPlotPage
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuMultiPlotPage : public RiuMultiPlotInterface, public caf::SelectionChangedReceiver
|
||||
class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, public RiuInterfaceToViewWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuMultiPlotPage( RimMultiPlotWindow* plotDefinition, QWidget* parent = nullptr );
|
||||
enum class ColumnCount
|
||||
{
|
||||
COLUMNS_1 = 1,
|
||||
COLUMNS_2 = 2,
|
||||
COLUMNS_3 = 3,
|
||||
COLUMNS_4 = 4,
|
||||
COLUMNS_UNLIMITED = 1000,
|
||||
};
|
||||
|
||||
public:
|
||||
RiuMultiPlotPage( RimPlotWindow* plotDefinition, QWidget* parent = nullptr );
|
||||
~RiuMultiPlotPage() override;
|
||||
|
||||
RimMultiPlotWindow* ownerPlotDefinition();
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
RimPlotWindow* ownerPlotDefinition();
|
||||
|
||||
void addPlot( RiuQwtPlotWidget* plotWidget ) override;
|
||||
void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) override;
|
||||
void removePlot( RiuQwtPlotWidget* plotWidget ) override;
|
||||
void addPlot( RiuQwtPlotWidget* plotWidget );
|
||||
void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index );
|
||||
void removePlot( RiuQwtPlotWidget* plotWidget );
|
||||
void removeAllPlots();
|
||||
int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ) override;
|
||||
int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
void setSelectionsVisible( bool visible );
|
||||
void setPlotTitle( const QString& plotTitle );
|
||||
void setTitleVisible( bool visible );
|
||||
void setFontSize( int fontSize );
|
||||
int fontSize() const;
|
||||
void setSubTitlesVisible( bool visible );
|
||||
|
||||
void setPlotTitle( const QString& plotTitle ) override;
|
||||
void setTitleVisible( bool visible ) override;
|
||||
void setFontSize( int fontSize ) override;
|
||||
int fontSize() const override;
|
||||
bool previewModeEnabled() const;
|
||||
void setPreviewModeEnabled( bool previewMode );
|
||||
|
||||
bool previewModeEnabled() const override;
|
||||
void setPreviewModeEnabled( bool previewMode ) override;
|
||||
void scheduleUpdate();
|
||||
void scheduleReplotOfAllPlots();
|
||||
virtual void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) {}
|
||||
|
||||
void scheduleUpdate() override;
|
||||
void scheduleReplotOfAllPlots() override;
|
||||
void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) override {}
|
||||
|
||||
void renderTo( QPaintDevice* paintDevice ) override;
|
||||
void renderTo( QPainter* painter, double scalingFactor );
|
||||
virtual void renderTo( QPaintDevice* paintDevice );
|
||||
void renderTo( QPainter* painter, double scalingFactor );
|
||||
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
@ -93,28 +102,19 @@ protected:
|
||||
QLabel* createTitleLabel() const;
|
||||
|
||||
void showEvent( QShowEvent* event ) override;
|
||||
void dragEnterEvent( QDragEnterEvent* event ) override;
|
||||
void dragMoveEvent( QDragMoveEvent* event ) override;
|
||||
void dragLeaveEvent( QDragLeaveEvent* event ) override;
|
||||
void dropEvent( QDropEvent* event ) override;
|
||||
bool hasHeightForWidth() const override;
|
||||
void updateMarginsFromPageLayout();
|
||||
|
||||
virtual bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const;
|
||||
|
||||
std::pair<int, int> rowAndColumnCount( int plotWidgetCount ) const;
|
||||
|
||||
virtual void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;
|
||||
|
||||
void setWidgetState( const QString& widgetState );
|
||||
|
||||
virtual bool showYAxis( int row, int column ) const;
|
||||
|
||||
void reinsertPlotWidgets();
|
||||
int alignCanvasTops();
|
||||
|
||||
void clearGridLayout();
|
||||
caf::UiStyleSheet createDropTargetStyleSheet();
|
||||
void clearGridLayout();
|
||||
|
||||
QList<QPointer<RiuQwtPlotWidget>> visiblePlotWidgets() const;
|
||||
QList<QPointer<RiuQwtPlotLegend>> legendsForVisiblePlots() const;
|
||||
@ -122,26 +122,28 @@ protected:
|
||||
|
||||
std::pair<int, int> findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const;
|
||||
|
||||
void stashWidgetStates();
|
||||
void restoreWidgetStates();
|
||||
|
||||
private slots:
|
||||
virtual void performUpdate();
|
||||
void onLegendUpdated();
|
||||
|
||||
protected:
|
||||
friend class RiuMultiPlotWindow;
|
||||
friend class RiuMultiPlotBook;
|
||||
|
||||
QPointer<QVBoxLayout> m_layout;
|
||||
QPointer<QHBoxLayout> m_plotLayout;
|
||||
QPointer<QFrame> m_plotWidgetFrame;
|
||||
QPointer<QGridLayout> m_gridLayout;
|
||||
QPointer<QLabel> m_plotTitle;
|
||||
QList<QPointer<QLabel>> m_subTitles;
|
||||
QList<QPointer<RiuQwtPlotLegend>> m_legends;
|
||||
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
|
||||
caf::PdmPointer<RimMultiPlotWindow> m_plotDefinition;
|
||||
QPointer<QLabel> m_dropTargetPlaceHolder;
|
||||
bool m_previewMode;
|
||||
QPointer<QVBoxLayout> m_layout;
|
||||
QPointer<QHBoxLayout> m_plotLayout;
|
||||
QPointer<QFrame> m_plotWidgetFrame;
|
||||
QPointer<QGridLayout> m_gridLayout;
|
||||
QPointer<QLabel> m_plotTitle;
|
||||
QList<QPointer<QLabel>> m_subTitles;
|
||||
QList<QPointer<RiuQwtPlotLegend>> m_legends;
|
||||
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
|
||||
caf::PdmPointer<RimPlotWindow> m_plotDefinition;
|
||||
|
||||
caf::UiStyleSheet m_dropTargetStyleSheet;
|
||||
bool m_previewMode;
|
||||
bool m_showSubTitles;
|
||||
|
||||
private:
|
||||
friend class RiaPlotWindowRedrawScheduler;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
@ -576,7 +577,7 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::updateMultiPlotToolBar()
|
||||
{
|
||||
RimMultiPlotWindow* plotWindow = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
|
||||
RimMultiPlot* plotWindow = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
|
||||
if ( plotWindow )
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> toolBarFields = {plotWindow->columnCountField()};
|
||||
@ -597,8 +598,8 @@ void RiuPlotMainWindow::updateMultiPlotToolBar()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi )
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
|
||||
RimMultiPlotWindow* multiPlot = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
|
||||
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
|
||||
RimMultiPlot* multiPlot = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
|
||||
if ( multiPlot )
|
||||
{
|
||||
summaryPlot = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryPlot>();
|
||||
|
@ -23,9 +23,7 @@
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimPlotCurve.h"
|
||||
|
||||
#include "RiuDraggableOverlayFrame.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
@ -66,12 +64,12 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plot, QWidget* parent )
|
||||
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent )
|
||||
: QwtPlot( parent )
|
||||
, m_plotDefinition( plot )
|
||||
, m_draggable( true )
|
||||
, m_plotDefinition( plotDefinition )
|
||||
, m_overlayMargins( 5 )
|
||||
{
|
||||
CAF_ASSERT( m_plotDefinition );
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( this );
|
||||
|
||||
this->installEventFilter( this );
|
||||
@ -89,6 +87,14 @@ RiuQwtPlotWidget::~RiuQwtPlotWidget()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot* RiuQwtPlotWidget::plotDefinition()
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -98,16 +104,31 @@ bool RiuQwtPlotWidget::isChecked() const
|
||||
{
|
||||
return m_plotDefinition->showWindow();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setDraggable( bool draggable )
|
||||
int RiuQwtPlotWidget::colSpan() const
|
||||
{
|
||||
m_draggable = draggable;
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
return m_plotDefinition->colSpan();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuQwtPlotWidget::rowSpan() const
|
||||
{
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
return m_plotDefinition->rowSpan();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -160,14 +181,6 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
|
||||
setAxisTitle( axis, axisTitle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot* RiuQwtPlotWidget::plotDefinition() const
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -186,6 +199,40 @@ void RiuQwtPlotWidget::setAxisTitleEnabled( QwtPlot::Axis axis, bool enable )
|
||||
applyAxisTitleToQwt( axis );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setPlotTitle( const QString& plotTitle )
|
||||
{
|
||||
m_plotTitle = plotTitle;
|
||||
applyPlotTitleToQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RiuQwtPlotWidget::plotTitle() const
|
||||
{
|
||||
return m_plotTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setPlotTitleEnabled( bool enabled )
|
||||
{
|
||||
m_plotTitleEnabled = enabled;
|
||||
applyPlotTitleToQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuQwtPlotWidget::plotTitleEnabled() const
|
||||
{
|
||||
return m_plotTitleEnabled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -399,6 +446,22 @@ void RiuQwtPlotWidget::scheduleReplot()
|
||||
RiaPlotWindowRedrawScheduler::instance()->schedulePlotWidgetReplot( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::stashWidgetStates()
|
||||
{
|
||||
m_plotStyleSheet.stashWidgetStates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::restoreWidgetStates()
|
||||
{
|
||||
m_plotStyleSheet.restoreWidgetStates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -442,27 +505,20 @@ void RiuQwtPlotWidget::updateLayout()
|
||||
updateOverlayFrameLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuQwtPlotWidget::sizeHint() const
|
||||
{
|
||||
return QSize( 0, 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuQwtPlotWidget::minimumSizeHint() const
|
||||
{
|
||||
return QSize( 0, 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
{
|
||||
QWheelEvent* wheelEvent = dynamic_cast<QWheelEvent*>( event );
|
||||
if ( wheelEvent && watched == canvas() )
|
||||
{
|
||||
event->accept();
|
||||
|
||||
emit onWheelEvent( wheelEvent );
|
||||
return true;
|
||||
}
|
||||
|
||||
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>( event );
|
||||
if ( mouseEvent )
|
||||
{
|
||||
@ -470,48 +526,32 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
|
||||
bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0;
|
||||
|
||||
if ( m_draggable && mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton )
|
||||
if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton )
|
||||
{
|
||||
m_clickPosition = mouseEvent->pos();
|
||||
}
|
||||
|
||||
if ( watched == this && !this->canvas()->geometry().contains( mouseEvent->pos() ) )
|
||||
{
|
||||
if ( m_draggable && mouseEvent->type() == QMouseEvent::MouseMove &&
|
||||
( mouseEvent->buttons() & Qt::LeftButton ) && !m_clickPosition.isNull() )
|
||||
{
|
||||
int dragLength = ( mouseEvent->pos() - m_clickPosition ).manhattanLength();
|
||||
if ( dragLength >= QApplication::startDragDistance() )
|
||||
{
|
||||
QPixmap pixmap = this->grab();
|
||||
QDrag* drag = new QDrag( this );
|
||||
QMimeData* mimeData = new QMimeData;
|
||||
mimeData->setImageData( pixmap );
|
||||
drag->setMimeData( mimeData );
|
||||
drag->setPixmap( pixmap );
|
||||
drag->setHotSpot( mouseEvent->pos() );
|
||||
drag->exec( Qt::MoveAction );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( mouseEvent->type() == QMouseEvent::MouseButtonRelease &&
|
||||
( mouseEvent->button() == Qt::LeftButton ) && !m_clickPosition.isNull() )
|
||||
if ( mouseEvent->type() == QMouseEvent::MouseButtonRelease && ( mouseEvent->button() == Qt::LeftButton ) &&
|
||||
!m_clickPosition.isNull() )
|
||||
{
|
||||
QWidget* childClicked = this->childAt( m_clickPosition );
|
||||
|
||||
if ( childClicked )
|
||||
{
|
||||
QwtScaleWidget* scaleWidget = qobject_cast<QwtScaleWidget*>( childClicked );
|
||||
if ( scaleWidget )
|
||||
{
|
||||
onAxisSelected( scaleWidget, toggleItemInSelection );
|
||||
m_clickPosition = QPoint();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
selectPlotOwner( toggleItemInSelection );
|
||||
endZoomOperations();
|
||||
emit plotSelected( toggleItemInSelection );
|
||||
m_clickPosition = QPoint();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -521,8 +561,9 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
if ( mouseEvent->type() == QMouseEvent::MouseButtonRelease && mouseEvent->button() == Qt::LeftButton &&
|
||||
!m_clickPosition.isNull() )
|
||||
{
|
||||
selectClosestCurve( mouseEvent->pos(), toggleItemInSelection );
|
||||
endZoomOperations();
|
||||
selectClosestCurve( mouseEvent->pos(), toggleItemInSelection );
|
||||
m_clickPosition = QPoint();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -563,6 +604,28 @@ void RiuQwtPlotWidget::resizeEvent( QResizeEvent* event )
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
emit onKeyPressEvent( event );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::applyPlotTitleToQwt()
|
||||
{
|
||||
QString plotTitleToApply = m_plotTitleEnabled ? m_plotTitle : QString( "" );
|
||||
QwtText plotTitle = this->title();
|
||||
if ( plotTitleToApply != plotTitle.text() )
|
||||
{
|
||||
plotTitle.setText( plotTitleToApply );
|
||||
setTitle( plotTitle );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -687,7 +750,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
|
||||
axisId = i;
|
||||
}
|
||||
}
|
||||
m_plotDefinition->onAxisSelected( axisId, toggleItemInSelection );
|
||||
emit axisSelected( axisId, toggleItemInSelection );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -706,19 +769,6 @@ caf::UiStyleSheet RiuQwtPlotWidget::createPlotStyleSheet() const
|
||||
|
||||
styleSheet.property( "selected" ).set( "border", QString( "1px solid %1" ).arg( highlightColor.name() ) );
|
||||
|
||||
if ( m_draggable )
|
||||
{
|
||||
QString backgroundGradient = QString( QString( "qlineargradient( x1 : 1, y1 : 0, x2 : 1, y2 : 1,"
|
||||
"stop: 0 %1, stop: 0.02 %2, stop:1 %3 )" )
|
||||
.arg( blendedHighlightColor.name() )
|
||||
.arg( nearlyBackgroundColor.name() )
|
||||
.arg( backgroundColor.name() ) );
|
||||
|
||||
styleSheet.pseudoState( "hover" ).set( "background", backgroundGradient );
|
||||
styleSheet.pseudoState( "hover" ).set( "border", QString( "1px dashed %1" ).arg( blendedHighlightColor.name() ) );
|
||||
}
|
||||
styleSheet.property( "dropTargetBefore" ).set( "border-left", "1px solid lime" );
|
||||
styleSheet.property( "dropTargetAfter" ).set( "border-right", "1px solid lime" );
|
||||
return styleSheet;
|
||||
}
|
||||
|
||||
@ -784,22 +834,6 @@ void RiuQwtPlotWidget::updateOverlayFrameLayout()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::selectPlotOwner( bool toggleItemInSelection )
|
||||
{
|
||||
if ( toggleItemInSelection )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( m_plotDefinition );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( m_plotDefinition );
|
||||
}
|
||||
scheduleReplot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -830,24 +864,10 @@ void RiuQwtPlotWidget::selectClosestCurve( const QPoint& pos, bool toggleItemInS
|
||||
resetCurveHighlighting();
|
||||
if ( closestCurve && distMin < 20 )
|
||||
{
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
RimPlotCurve* selectedCurve = dynamic_cast<RimPlotCurve*>(
|
||||
m_plotDefinition->findPdmObjectFromQwtCurve( closestCurve ) );
|
||||
if ( selectedCurve )
|
||||
{
|
||||
if ( toggleItemInSelection )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( selectedCurve );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( selectedCurve );
|
||||
}
|
||||
// TODO: highlight all selected curves
|
||||
highlightCurve( closestCurve );
|
||||
}
|
||||
}
|
||||
// TODO: highlight all selected curves
|
||||
highlightCurve( closestCurve );
|
||||
emit curveSelected( closestCurve, toggleItemInSelection );
|
||||
|
||||
if ( distMin < 10 )
|
||||
{
|
||||
selectPoint( closestCurve, closestCurvePoint );
|
||||
@ -860,7 +880,7 @@ void RiuQwtPlotWidget::selectClosestCurve( const QPoint& pos, bool toggleItemInS
|
||||
}
|
||||
else
|
||||
{
|
||||
selectPlotOwner( toggleItemInSelection );
|
||||
emit plotSelected( toggleItemInSelection );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ class QEvent;
|
||||
class QLabel;
|
||||
class QPainter;
|
||||
class QPaintDevice;
|
||||
class QWheelEvent;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -56,14 +57,15 @@ class RiuQwtPlotWidget : public QwtPlot
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuQwtPlotWidget( RimPlot* plotTrackDefinition, QWidget* parent = nullptr );
|
||||
RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
||||
~RiuQwtPlotWidget() override;
|
||||
|
||||
RimPlot* plotDefinition() const;
|
||||
RimPlot* plotDefinition();
|
||||
|
||||
bool isChecked() const;
|
||||
|
||||
void setDraggable( bool draggable );
|
||||
int colSpan() const;
|
||||
int rowSpan() const;
|
||||
|
||||
int axisTitleFontSize( QwtPlot::Axis axis ) const;
|
||||
int axisValueFontSize( QwtPlot::Axis axis ) const;
|
||||
@ -76,6 +78,11 @@ public:
|
||||
void setAxisTitleText( QwtPlot::Axis axis, const QString& title );
|
||||
void setAxisTitleEnabled( QwtPlot::Axis axis, bool enable );
|
||||
|
||||
void setPlotTitle( const QString& plotTitle );
|
||||
const QString& plotTitle() const;
|
||||
void setPlotTitleEnabled( bool enabled );
|
||||
bool plotTitleEnabled() const;
|
||||
|
||||
QwtInterval axisRange( QwtPlot::Axis axis );
|
||||
void setAxisRange( QwtPlot::Axis axis, double min, double max );
|
||||
|
||||
@ -99,6 +106,8 @@ public:
|
||||
QPoint dragStartPosition() const;
|
||||
|
||||
void scheduleReplot();
|
||||
void stashWidgetStates();
|
||||
void restoreWidgetStates();
|
||||
void setWidgetState( const QString& widgetState );
|
||||
|
||||
void addOverlayFrame( RiuDraggableOverlayFrame* overlayWidget );
|
||||
@ -109,14 +118,21 @@ public:
|
||||
void renderTo( QPaintDevice* painter, const QRect& targetRect );
|
||||
int overlayMargins() const;
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
bool eventFilter( QObject* watched, QEvent* event ) override;
|
||||
void hideEvent( QHideEvent* event ) override;
|
||||
void showEvent( QShowEvent* event ) override;
|
||||
void resizeEvent( QResizeEvent* event ) override;
|
||||
signals:
|
||||
void plotSelected( bool toggleSelection );
|
||||
void axisSelected( int axisId, bool toggleSelection );
|
||||
void curveSelected( QwtPlotCurve* curve, bool toggleSelection );
|
||||
void onKeyPressEvent( QKeyEvent* event );
|
||||
void onWheelEvent( QWheelEvent* event );
|
||||
|
||||
protected:
|
||||
bool eventFilter( QObject* watched, QEvent* event ) override;
|
||||
void hideEvent( QHideEvent* event ) override;
|
||||
void showEvent( QShowEvent* event ) override;
|
||||
void resizeEvent( QResizeEvent* event ) override;
|
||||
void keyPressEvent( QKeyEvent* event ) override;
|
||||
|
||||
void applyPlotTitleToQwt();
|
||||
void applyAxisTitleToQwt( QwtPlot::Axis axis );
|
||||
|
||||
virtual void selectPoint( QwtPlotCurve* curve, int pointNumber );
|
||||
@ -125,7 +141,6 @@ protected:
|
||||
virtual void endZoomOperations();
|
||||
|
||||
private:
|
||||
void selectPlotOwner( bool toggleItemInSelection = false );
|
||||
void selectClosestCurve( const QPoint& pos, bool toggleItemInSelection = false );
|
||||
static int defaultMinimumWidth();
|
||||
void replot() override;
|
||||
@ -145,8 +160,9 @@ private:
|
||||
std::map<QwtPlot::Axis, QString> m_axisTitles;
|
||||
std::map<QwtPlot::Axis, bool> m_axisTitlesEnabled;
|
||||
QPointer<QwtPlotPicker> m_plotPicker;
|
||||
bool m_draggable;
|
||||
const int m_overlayMargins;
|
||||
QString m_plotTitle;
|
||||
bool m_plotTitleEnabled;
|
||||
|
||||
QList<QPointer<RiuDraggableOverlayFrame>> m_overlayFrames;
|
||||
|
||||
|
@ -92,8 +92,8 @@ static EnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent /*= nullptr*/ )
|
||||
: RiuQwtPlotWidget( plotDefinition, parent )
|
||||
RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= nullptr*/ )
|
||||
: RiuQwtPlotWidget( plot, parent )
|
||||
{
|
||||
// LeftButton for the zooming
|
||||
m_zoomerLeft = new RiuQwtPlotZoomer( canvas() );
|
||||
@ -125,9 +125,6 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent /
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( this );
|
||||
RiuQwtPlotTools::setDefaultAxes( this );
|
||||
|
||||
this->installEventFilter( this );
|
||||
this->canvas()->installEventFilter( this );
|
||||
|
||||
setLegendVisible( true );
|
||||
}
|
||||
|
||||
@ -156,14 +153,6 @@ void RiuSummaryQwtPlot::useTimeBasedTimeAxis()
|
||||
setAxisScaleDraw( QwtPlot::xBottom, new QwtScaleDraw() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiuSummaryQwtPlot::ownerViewWindow() const
|
||||
{
|
||||
return dynamic_cast<RimViewWindow*>( plotDefinition() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -207,19 +196,6 @@ void RiuSummaryQwtPlot::setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithm
|
||||
if ( m_wheelZoomer ) m_wheelZoomer->setAxisIsLogarithmic( axis, logarithmic );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQwtPlot::keyPressEvent( QKeyEvent* keyEvent )
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( plotDefinition() );
|
||||
|
||||
if ( summaryPlot )
|
||||
{
|
||||
summaryPlot->handleKeyPressEvent( keyEvent );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -228,7 +204,7 @@ void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
QMenu menu;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem( plotDefinition() );
|
||||
emit plotSelected( false );
|
||||
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicSavePlotTemplateFeature";
|
||||
@ -274,7 +250,5 @@ void RiuSummaryQwtPlot::endZoomOperations()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQwtPlot::onZoomedSlot()
|
||||
{
|
||||
plotDefinition()->setAutoScaleXEnabled( false );
|
||||
plotDefinition()->setAutoScaleYEnabled( false );
|
||||
plotDefinition()->updateZoomFromQwt();
|
||||
emit plotZoomed();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QPointer>
|
||||
|
||||
class RimEnsembleParameterColorHandlerInterface;
|
||||
class RimSummaryPlot;
|
||||
class RiuCvfOverlayItemWidget;
|
||||
class RiuQwtPlotZoomer;
|
||||
class RiuQwtPlotWheelZoomer;
|
||||
@ -36,12 +37,12 @@ class RiuQwtPlotWheelZoomer;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuSummaryQwtPlot : public RiuQwtPlotWidget, public RiuInterfaceToViewWindow
|
||||
class RiuSummaryQwtPlot : public RiuQwtPlotWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
||||
RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent = nullptr );
|
||||
~RiuSummaryQwtPlot() override;
|
||||
|
||||
void useDateBasedTimeAxis(
|
||||
@ -52,15 +53,15 @@ public:
|
||||
|
||||
void useTimeBasedTimeAxis();
|
||||
|
||||
RimViewWindow* ownerViewWindow() const override;
|
||||
|
||||
void setLegendFontSize( int fontSize );
|
||||
void setLegendVisible( bool visible );
|
||||
|
||||
void setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithmic );
|
||||
|
||||
signals:
|
||||
void plotZoomed();
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* ) override;
|
||||
void contextMenuEvent( QContextMenuEvent* ) override;
|
||||
void setDefaults();
|
||||
bool isZoomerActive() const override;
|
||||
|
@ -73,22 +73,6 @@ void RiuWellLogPlot::renderTo( QPaintDevice* paintDevice )
|
||||
m_trackScrollBar->setVisible( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellLogPlot::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
wellLogPlotDefinition()->handleKeyPressEvent( event );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuWellLogPlot::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
|
||||
{
|
||||
return dynamic_cast<const RiuWellLogTrack*>( plotWidget ) != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -131,7 +115,7 @@ void RiuWellLogPlot::slotSetMinDepth( int value )
|
||||
|
||||
double delta = value - minimumDepth;
|
||||
wellLogPlotDefinition()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta );
|
||||
wellLogPlotDefinition()->setAutoScaleYEnabled( false );
|
||||
wellLogPlotDefinition()->setAutoScaleDepthEnabled( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -23,7 +23,7 @@
|
||||
class RiuQwtPlotWidget;
|
||||
class RimWellLogPlot;
|
||||
|
||||
class RiuWellLogPlot : public RiuMultiPlotPage, public RiuInterfaceToViewWindow
|
||||
class RiuWellLogPlot : public RiuMultiPlotPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -35,8 +35,6 @@ public:
|
||||
void renderTo( QPaintDevice* paintDevice ) override;
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* event ) override;
|
||||
bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const override;
|
||||
bool showYAxis( int row, int column ) const override;
|
||||
|
||||
void reinsertScrollbar();
|
||||
|
@ -27,14 +27,11 @@
|
||||
|
||||
#include <QWheelEvent>
|
||||
|
||||
#define RIU_SCROLLWHEEL_ZOOMFACTOR 1.1
|
||||
#define RIU_SCROLLWHEEL_PANFACTOR 0.1
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* plotTrackDefinition, QWidget* parent /*= nullptr */ )
|
||||
: RiuQwtPlotWidget( plotTrackDefinition, parent )
|
||||
RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nullptr */ )
|
||||
: RiuQwtPlotWidget( track, parent )
|
||||
{
|
||||
setAxisEnabled( QwtPlot::yLeft, true );
|
||||
setAxisEnabled( QwtPlot::yRight, false );
|
||||
@ -47,49 +44,6 @@ RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* plotTrackDefinition, QWidget*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellLogTrack::~RiuWellLogTrack() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuWellLogTrack::eventFilter( QObject* watched, QEvent* event )
|
||||
{
|
||||
QWheelEvent* wheelEvent = dynamic_cast<QWheelEvent*>( event );
|
||||
if ( wheelEvent && watched == canvas() )
|
||||
{
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotDefinition() );
|
||||
CAF_ASSERT( track );
|
||||
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
track->firstAncestorOrThisOfType( wellLogPlot );
|
||||
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
if ( wheelEvent->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
QwtScaleMap scaleMap = canvasMap( QwtPlot::yLeft );
|
||||
double zoomCenter = scaleMap.invTransform( wheelEvent->pos().y() );
|
||||
|
||||
if ( wheelEvent->delta() > 0 )
|
||||
{
|
||||
wellLogPlot->setDepthAxisRangeByFactorAndCenter( RIU_SCROLLWHEEL_ZOOMFACTOR, zoomCenter );
|
||||
}
|
||||
else
|
||||
{
|
||||
wellLogPlot->setDepthAxisRangeByFactorAndCenter( 1.0 / RIU_SCROLLWHEEL_ZOOMFACTOR, zoomCenter );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wellLogPlot->setDepthAxisRangeByPanDepth( wheelEvent->delta() < 0 ? RIU_SCROLLWHEEL_PANFACTOR
|
||||
: -RIU_SCROLLWHEEL_PANFACTOR );
|
||||
}
|
||||
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return RiuQwtPlotWidget::eventFilter( watched, event );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
class RimWellLogTrack;
|
||||
class QWheelEvent;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -32,12 +33,9 @@ class RiuWellLogTrack : public RiuQwtPlotWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuWellLogTrack( RimWellLogTrack* plotTrackDefinition, QWidget* parent = nullptr );
|
||||
RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent = nullptr );
|
||||
~RiuWellLogTrack() override;
|
||||
|
||||
protected:
|
||||
bool eventFilter( QObject* watched, QEvent* event ) override;
|
||||
|
||||
private:
|
||||
void setAxisEnabled( QwtPlot::Axis axis, bool enabled );
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user