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

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

View File

@@ -153,6 +153,9 @@ RiaApplication::RiaApplication()
RiaApplication::~RiaApplication()
{
delete m_preferences;
delete m_project;
RiaFontCache::clear();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -129,3 +129,11 @@ RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize( int pointSize )
}
return closestEnumValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFontCache::clear()
{
ms_fonts.clear();
}

View File

@@ -56,6 +56,8 @@ public:
static int pointSizeFromFontSizeEnum( FontSize fontSize );
static FontSize fontSizeEnumFromPointSize( int pointSize );
static void clear();
private:
static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
};

View File

@@ -27,6 +27,7 @@
#include "RiaFontCache.h"
#include "RiaImportEclipseCaseTools.h"
#include "RiaLogging.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaPreferences.h"
#include "RiaProjectModifier.h"
#include "RiaRegressionTestRunner.h"
@@ -58,9 +59,9 @@
#include "RimGeoMechView.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimMultiPlotCollection.h"
#include "RimObservedDataCollection.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h"
@@ -311,7 +312,7 @@ void RiaGuiApplication::loadAndUpdatePlotData()
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimGridPlotWindowCollection* gpwColl = nullptr;
RimMultiPlotCollection* gpwColl = nullptr;
if ( m_project->mainPlotCollection() )
{
@@ -347,9 +348,9 @@ void RiaGuiApplication::loadAndUpdatePlotData()
{
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
}
if ( m_project->mainPlotCollection()->combinationPlotCollection() )
if ( m_project->mainPlotCollection()->multiPlotCollection() )
{
gpwColl = m_project->mainPlotCollection()->combinationPlotCollection();
gpwColl = m_project->mainPlotCollection()->multiPlotCollection();
}
}
@@ -362,7 +363,7 @@ void RiaGuiApplication::loadAndUpdatePlotData()
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
plotCount += gpwColl ? gpwColl->gridPlotWindows().size() : 0;
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
if ( plotCount > 0 )
{
@@ -439,9 +440,9 @@ void RiaGuiApplication::loadAndUpdatePlotData()
if ( gpwColl )
{
for ( const auto& gridPlotWindow : gpwColl->gridPlotWindows() )
for ( const auto& multiPlot : gpwColl->multiPlots() )
{
gridPlotWindow->loadDataAndUpdate();
multiPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
@@ -1449,6 +1450,7 @@ void RiaGuiApplication::onProjectBeingClosed()
RicHoloLensSessionManager::refreshToolbarState();
RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate();
RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates();
RiaGuiApplication::clearAllSelections();

View File

@@ -17,7 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiuGridPlotWindow.h"
#include "RiuMultiPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include <QCoreApplication>
@@ -40,7 +40,7 @@ RiaPlotWindowRedrawScheduler* RiaPlotWindowRedrawScheduler::instance()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::schedulePlotWindowUpdate( RiuGridPlotWindow* plotWindow )
void RiaPlotWindowRedrawScheduler::schedulePlotWindowUpdate( RiuMultiPlotWindow* plotWindow )
{
m_plotWindowsToUpdate.push_back( plotWindow );
@@ -78,10 +78,10 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
{
std::set<RiuQwtPlotWidget*> updatedPlots;
std::set<RiuGridPlotWindow*> updatedPlotWindows;
std::set<RiuQwtPlotWidget*> updatedPlots;
std::set<RiuMultiPlotWindow*> updatedPlotWindows;
for ( RiuGridPlotWindow* plotWindow : m_plotWindowsToUpdate )
for ( RiuMultiPlotWindow* plotWindow : m_plotWindowsToUpdate )
{
if ( plotWindow && !updatedPlotWindows.count( plotWindow ) )
{
@@ -111,7 +111,7 @@ void RiaPlotWindowRedrawScheduler::slotUpdateAndReplotScheduledItemsWhenReady()
{
if ( caf::ProgressState::isActive() )
{
startTimer( 10 );
startTimer( 100 );
return;
}

View File

@@ -26,7 +26,7 @@
#include <vector>
class RiuGridPlotWindow;
class RiuMultiPlotWindow;
class RiuQwtPlotWidget;
class RiaPlotWindowRedrawScheduler : public QObject
@@ -35,7 +35,7 @@ class RiaPlotWindowRedrawScheduler : public QObject
public:
static RiaPlotWindowRedrawScheduler* instance();
void schedulePlotWindowUpdate( RiuGridPlotWindow* plotWindow );
void schedulePlotWindowUpdate( RiuMultiPlotWindow* plotWindow );
void schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget );
void clearAllScheduledUpdates();
void performScheduledUpdatesAndReplots();
@@ -44,10 +44,13 @@ private slots:
void slotUpdateAndReplotScheduledItemsWhenReady();
private:
RiaPlotWindowRedrawScheduler() = default;
~RiaPlotWindowRedrawScheduler() = default;
void startTimer( int msecs );
private:
std::vector<QPointer<RiuQwtPlotWidget>> m_plotWidgetsToReplot;
std::vector<QPointer<RiuGridPlotWindow>> m_plotWindowsToUpdate;
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
std::vector<QPointer<RiuQwtPlotWidget>> m_plotWidgetsToReplot;
std::vector<QPointer<RiuMultiPlotWindow>> m_plotWindowsToUpdate;
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
};

View File

@@ -36,6 +36,12 @@ class RiaCurveDataTools
public:
typedef std::vector<std::pair<size_t, size_t>> CurveIntervals;
enum ErrorAxis
{
ERROR_ALONG_X_AXIS,
ERROR_ALONG_Y_AXIS
};
public:
static CurveIntervals calculateIntervalsOfValidValues( const std::vector<double>& values,
bool includePositiveValuesOnly );

View File

@@ -245,7 +245,7 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
for ( RimWellLogPlot* wellLogPlot : wellLogPlots )
{
QString title = wellLogPlot->description();
QString title = wellLogPlot->multiPlotTitle();
QString text = wellLogPlot->asciiDataForPlotExport();
RicShowPlotDataFeature::showTextWindow( title, text );
}

View File

@@ -85,7 +85,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextUi.h
${CMAKE_CURRENT_LIST_DIR}/RicNewGridPlotWindowFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h
)
@@ -169,7 +169,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewGridPlotWindowFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp
)

View File

@@ -40,8 +40,7 @@ CAF_CMD_SOURCE_INIT( RicAddEclipseInputPropertyFeature, "RicAddEclipseInputPrope
//--------------------------------------------------------------------------------------------------
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
{
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputPropertyCollection>() ||
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputCase>() ||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputCase>() ||
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseResultCase>();
}
@@ -50,26 +49,11 @@ bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicAddEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
{
RimEclipseCase* eclipseCase = nullptr;
RimEclipseCase* eclipseCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
if ( !eclipseCase ) return;
RimEclipseInputPropertyCollection* inputPropertyCollection =
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputPropertyCollection>();
if ( !inputPropertyCollection )
{
// No property collection selected: triggered from RimEclipseInputCase/RimEclipseResultCase.
eclipseCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
if ( eclipseCase )
{
inputPropertyCollection = eclipseCase->inputPropertyCollection();
}
}
else
{
// Triggered from collection: get eclipse case ancestor
inputPropertyCollection->firstAncestorOrThisOfTypeAsserted( eclipseCase );
}
if ( !inputPropertyCollection || !eclipseCase ) return;
RimEclipseInputPropertyCollection* inputPropertyCollection = eclipseCase->inputPropertyCollection();
if ( !inputPropertyCollection ) return;
QFileInfo fi( eclipseCase->gridFileName() );
QString casePath = fi.absolutePath();

View File

@@ -50,10 +50,10 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
bool capitalizeFileNames,
double resampleInterval )
{
std::vector<RimWellLogCurve*> allCurves;
std::vector<RimPlotInterface*> plots = plotWindow->visiblePlots();
std::vector<RimWellLogCurve*> allCurves;
std::vector<RimPlot*> plots = plotWindow->visiblePlots();
for ( RimPlotInterface* plot : plots )
for ( RimPlot* plot : plots )
{
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plot );
if ( track )

View File

@@ -20,6 +20,7 @@
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaViewRedrawScheduler.h"
#include "Rim3dOverlayInfoConfig.h"
@@ -113,6 +114,7 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QS
Riu3DMainWindowTools::setActiveViewer( viewer->layoutWidget() );
RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate();
RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates();
// riv->updateCurrentTimeStepAndRedraw();
riv->createDisplayModelAndRedraw();

View File

@@ -139,7 +139,9 @@ QString RicSavePlotTemplateFeature::createTextFromObject( RimSummaryPlot* summar
QString objectAsText = summaryPlot->writeObjectToXmlString();
caf::PdmObjectHandle* obj =
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, caf::PdmDefaultObjectFactory::instance() );
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText,
caf::PdmDefaultObjectFactory::instance(),
true );
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
if ( newSummaryPlot )

View File

@@ -64,7 +64,9 @@ RimSummaryPlot* RicSummaryPlotTemplateTools::createPlotFromTemplateFile( const Q
QString objectAsText = stream.readAll();
caf::PdmObjectHandle* obj =
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, caf::PdmDefaultObjectFactory::instance() );
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText,
caf::PdmDefaultObjectFactory::instance(),
true );
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
if ( newSummaryPlot )

View File

@@ -345,7 +345,8 @@ void RicDeleteItemExec::undo()
{
caf::PdmObjectHandle* obj =
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( m_commandData->m_deletedObjectAsXml(),
caf::PdmDefaultObjectFactory::instance() );
caf::PdmDefaultObjectFactory::instance(),
false );
listField->insertAt( m_commandData->m_indexToObject, obj );

View File

@@ -39,12 +39,12 @@
#include "RimGeoMechView.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimGridPlotWindow.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionResultDefinition.h"
#include "RimMultiPlotWindow.h"
#include "RimPerforationInterval.h"
#include "RimPolylinesAnnotation.h"
#include "RimReachCircleAnnotation.h"
@@ -111,7 +111,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
if ( dynamic_cast<RimWellLogCurve*>( uiItem ) ) return true;
if ( dynamic_cast<RimSummaryPlot*>( uiItem ) )
{
RimGridPlotWindow* plotWindow = nullptr;
RimMultiPlotWindow* plotWindow = nullptr;
static_cast<RimSummaryPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
return plotWindow == nullptr;
}
@@ -142,7 +142,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
if ( dynamic_cast<RimGridCrossPlot*>( uiItem ) )
{
RimGridPlotWindow* plotWindow = nullptr;
RimMultiPlotWindow* plotWindow = nullptr;
static_cast<RimGridCrossPlot*>( uiItem )->firstAncestorOrThisOfType( plotWindow );
return plotWindow == nullptr;
}

View File

@@ -17,14 +17,14 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewGridPlotWindowFeature.h"
#include "RicNewMultiPlotFeature.h"
#include "RiaApplication.h"
#include "RimGridPlotWindow.h"
#include "RimGridPlotWindowCollection.h"
#include "RimMainPlotCollection.h"
#include "RimPlotInterface.h"
#include "RimMultiPlotCollection.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
#include "RimProject.h"
#include "RiuPlotMainWindowTools.h"
@@ -34,38 +34,38 @@
#include "cvfAssert.h"
RICF_SOURCE_INIT( RicNewGridPlotWindowFeature, "RicNewGridPlotWindowFeature", "createCombinationPlot" );
RICF_SOURCE_INIT( RicNewMultiPlotFeature, "RicNewMultiPlotFeature", "createMultiPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewGridPlotWindowFeature::RicNewGridPlotWindowFeature()
RicNewMultiPlotFeature::RicNewMultiPlotFeature()
{
CAF_PDM_InitObject( "Create Combination Plot", "", "", "" );
CAF_PDM_InitObject( "Create Multi Plot", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_plots, "plots", "Plots", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse RicNewGridPlotWindowFeature::execute()
RicfCommandResponse RicNewMultiPlotFeature::execute()
{
RimProject* project = RiaApplication::instance()->project();
RimGridPlotWindowCollection* plotCollection = project->mainPlotCollection()->combinationPlotCollection();
RimProject* project = RiaApplication::instance()->project();
RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection();
RimGridPlotWindow* plotWindow = new RimGridPlotWindow;
plotWindow->setDescription( QString( "Combination Plot %1" ).arg( plotCollection->gridPlotWindows().size() + 1 ) );
RimMultiPlotWindow* plotWindow = new RimMultiPlotWindow;
plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) );
plotWindow->setAsPlotMdiWindow();
plotCollection->addGridPlotWindow( plotWindow );
plotCollection->addMultiPlot( plotWindow );
if ( !m_plots().empty() )
{
std::vector<RimPlotInterface*> plotInterfaces;
std::vector<RimPlot*> plots;
for ( auto ptr : m_plots() )
{
plotInterfaces.push_back( reinterpret_cast<RimPlotInterface*>( ptr ) );
plots.push_back( reinterpret_cast<RimPlot*>( ptr ) );
}
plotWindow->movePlotsToThis( plotInterfaces, nullptr );
plotWindow->movePlotsToThis( plots, nullptr );
}
plotCollection->updateAllRequiredEditors();
@@ -80,33 +80,33 @@ RicfCommandResponse RicNewGridPlotWindowFeature::execute()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewGridPlotWindowFeature::isCommandEnabled()
bool RicNewMultiPlotFeature::isCommandEnabled()
{
RimGridPlotWindowCollection* gridPlotCollection =
caf::SelectionManager::instance()->selectedItemOfType<RimGridPlotWindowCollection>();
if ( gridPlotCollection )
RimMultiPlotCollection* multiPlotCollection =
caf::SelectionManager::instance()->selectedItemOfType<RimMultiPlotCollection>();
if ( multiPlotCollection )
{
return true;
}
auto selectedPlots = selectedPlotInterfaces();
auto plots = selectedPlots();
std::vector<caf::PdmUiItem*> selectedUiItems;
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
return !selectedPlots.empty() && selectedPlots.size() == selectedUiItems.size();
return !plots.empty() && plots.size() == selectedUiItems.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridPlotWindowFeature::onActionTriggered( bool isChecked )
void RicNewMultiPlotFeature::onActionTriggered( bool isChecked )
{
m_plots.v().clear();
auto selectedPlots = selectedPlotInterfaces();
for ( RimPlotInterface* plotInterface : selectedPlots )
auto plots = selectedPlots();
for ( RimPlot* plot : plots )
{
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plotInterface ) );
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plot ) );
}
execute();
}
@@ -114,16 +114,16 @@ void RicNewGridPlotWindowFeature::onActionTriggered( bool isChecked )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridPlotWindowFeature::setupActionLook( QAction* actionToSetup )
void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
{
if ( selectedPlotInterfaces().empty() )
if ( selectedPlots().empty() )
{
actionToSetup->setText( "New Empty Plot Report" );
actionToSetup->setText( "New Empty Multi Plot" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
}
else
{
actionToSetup->setText( "Create Plot Report from Selected Plots" );
actionToSetup->setText( "Create Multi Plot from Selected Plots" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
}
}
@@ -131,19 +131,19 @@ void RicNewGridPlotWindowFeature::setupActionLook( QAction* actionToSetup )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RicNewGridPlotWindowFeature::selectedPlotInterfaces()
std::vector<RimPlot*> RicNewMultiPlotFeature::selectedPlots()
{
std::vector<caf::PdmUiItem*> uiItems;
caf::SelectionManager::instance()->selectedItems( uiItems );
std::vector<RimPlotInterface*> plotInterfaces;
std::vector<RimPlot*> plots;
for ( caf::PdmUiItem* uiItem : uiItems )
{
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( uiItem );
RimPlot* plotInterface = dynamic_cast<RimPlot*>( uiItem );
if ( plotInterface )
{
plotInterfaces.push_back( plotInterface );
plots.push_back( plotInterface );
}
}
return plotInterfaces;
return plots;
}

View File

@@ -25,17 +25,17 @@
#include <vector>
class RimPlotInterface;
class RimPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewGridPlotWindowFeature : public caf::CmdFeature, public RicfCommandObject
class RicNewMultiPlotFeature : public caf::CmdFeature, public RicfCommandObject
{
RICF_HEADER_INIT;
public:
RicNewGridPlotWindowFeature();
RicNewMultiPlotFeature();
virtual RicfCommandResponse execute() override;
@@ -45,7 +45,7 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static std::vector<RimPlotInterface*> selectedPlotInterfaces();
static std::vector<RimPlot*> selectedPlots();
private:
caf::PdmField<std::vector<uint64_t>> m_plots;

View File

@@ -33,6 +33,8 @@
#include <QAction>
#include <memory>
CAF_CMD_SOURCE_INIT( RicEditSummaryPlotFeature, "RicEditSummaryPlotFeature" );
//--------------------------------------------------------------------------------------------------
@@ -60,9 +62,14 @@ void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot()
//--------------------------------------------------------------------------------------------------
RicSummaryCurveCreatorDialog* RicEditSummaryPlotFeature::curveCreatorDialog()
{
static RicSummaryCurveCreatorDialog* singletonDialog = new RicSummaryCurveCreatorDialog( nullptr );
static std::unique_ptr<RicSummaryCurveCreatorDialog> singletonDialog;
return singletonDialog;
if ( !singletonDialog )
{
singletonDialog.reset( new RicSummaryCurveCreatorDialog( nullptr ) );
}
return singletonDialog.get();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -910,7 +910,7 @@ void RicSummaryCurveCreator::selectionEditorFieldChanged()
void RicSummaryCurveCreator::proxyEnablePlotAutoTitle( const bool& enable )
{
m_previewPlot->enableAutoPlotTitle( enable );
m_previewPlot->setPlotTitleVisible( enable );
m_previewPlot->setShowPlotTitle( enable );
m_previewPlot->updateCurveNames();
m_previewPlot->loadDataAndUpdate();
}

View File

@@ -36,7 +36,7 @@
RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog( QWidget* parent )
: QDialog( parent, RiuTools::defaultDialogFlags() )
{
m_curveCreatorSplitterUi = new RicSummaryCurveCreatorSplitterUi( this );
m_curveCreatorSplitterUi.reset( new RicSummaryCurveCreatorSplitterUi( this ) );
QWidget* propertyWidget = m_curveCreatorSplitterUi->getOrCreateWidget( this );
@@ -46,7 +46,7 @@ RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog( QWidget* parent )
setWindowTitle( "Plot Editor" );
resize( 1200, 800 );
connect( m_curveCreatorSplitterUi, SIGNAL( signalCloseButtonPressed() ), this, SLOT( accept() ) );
connect( m_curveCreatorSplitterUi.get(), SIGNAL( signalCloseButtonPressed() ), this, SLOT( accept() ) );
connect( this, SIGNAL( finished( int ) ), this, SLOT( slotDialogFinished() ) );
}
@@ -54,7 +54,10 @@ RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog( QWidget* parent )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicSummaryCurveCreatorDialog::~RicSummaryCurveCreatorDialog() {}
RicSummaryCurveCreatorDialog::~RicSummaryCurveCreatorDialog()
{
m_curveCreatorSplitterUi->setPdmObject( nullptr );
}
//--------------------------------------------------------------------------------------------------
///

View File

@@ -20,6 +20,8 @@
#include <QDialog>
#include <memory>
namespace caf
{
class PdmObject;
@@ -47,5 +49,5 @@ private slots:
void slotDialogFinished();
private:
RicSummaryCurveCreatorSplitterUi* m_curveCreatorSplitterUi;
std::unique_ptr<RicSummaryCurveCreatorSplitterUi> m_curveCreatorSplitterUi;
};

View File

@@ -91,7 +91,7 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
delete viewLinker;
}
activeView->updateHolder();
activeView->updateAutoName();
}
RiaApplication::instance()->project()->viewLinkerCollection.uiCapability()->updateConnectedEditors();

View File

@@ -65,7 +65,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimWellLogPlot* wellLogPlot = selectedWellLogPlots.at( 0 );
QString defaultFileName = defaultDir + "/" +
caf::Utils::makeValidFileBasename( ( wellLogPlot->description() ) ) + ".ascii";
caf::Utils::makeValidFileBasename( ( wellLogPlot->multiPlotTitle() ) ) + ".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->description() ) + ".ascii";
QString fileName = caf::Utils::makeValidFileBasename( wellLogPlot->multiPlotTitle() ) + ".ascii";
fileNames.push_back( fileName );
}
@@ -92,7 +92,8 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered( bool isChecked )
RiaLogging::info( QString( "Writing to directory %!" ).arg( saveDir ) );
for ( RimWellLogPlot* wellLogPlot : selectedWellLogPlots )
{
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename( wellLogPlot->multiPlotTitle() ) +
".ascii";
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( fileName, wellLogPlot );
progress++;
@@ -118,7 +119,8 @@ QString RicAsciiExportWellLogPlotFeature::makeValidExportFileName( const RimWell
const QString& prefix,
bool capitalizeFileName )
{
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->multiPlotTitle() ) +
".ascii";
if ( capitalizeFileName ) fileName = fileName.toUpper();
QDir dir( folder );
@@ -141,7 +143,7 @@ bool RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( const QString&
QTextStream out( &file );
out << wellLogPlot->description();
out << wellLogPlot->multiPlotTitle();
out << "\n";
out << wellLogPlot->asciiDataForPlotExport();
out << "\n\n";

View File

@@ -21,12 +21,12 @@
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RiaGuiApplication.h"
#include "RiuGridPlotWindow.h"
#include "RiuMultiPlotWindow.h"
#include "RiuPlotMainWindow.h"
#include "RiuQwtPlotWidget.h"
#include "RimGridPlotWindow.h"
#include "RimPlotInterface.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotWindow.h"
#include "RimWellLogTrack.h"
#include "cafSelectionManager.h"
@@ -50,9 +50,9 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
size_t plotsSelected = 0;
for ( caf::PdmObject* object : selection )
{
RimGridPlotWindow* gridPlotWindow = nullptr;
object->firstAncestorOrThisOfType( gridPlotWindow );
if ( dynamic_cast<RimPlotInterface*>( object ) && gridPlotWindow )
RimMultiPlotWindow* multiPlot = nullptr;
object->firstAncestorOrThisOfType( multiPlot );
if ( dynamic_cast<RimPlotWindow*>( object ) && multiPlot )
{
plotsSelected++;
}
@@ -70,28 +70,26 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
std::vector<caf::PdmObject*> selection;
std::vector<RimPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
std::set<RimGridPlotWindow*> alteredPlotWindows;
std::set<RimMultiPlotWindow*> alteredPlotWindows;
for ( size_t i = 0; i < selection.size(); i++ )
for ( RimPlot* plot : selection )
{
RimPlotInterface* plot = dynamic_cast<RimPlotInterface*>( selection[i] );
RimGridPlotWindow* plotWindow = nullptr;
selection[i]->firstAncestorOrThisOfType( plotWindow );
RimMultiPlotWindow* plotWindow = nullptr;
plot->firstAncestorOrThisOfType( plotWindow );
if ( plot && plotWindow )
{
alteredPlotWindows.insert( plotWindow );
plotWindow->removePlot( plot );
caf::SelectionManager::instance()->removeObjectFromAllSelections( selection[i] );
caf::SelectionManager::instance()->removeObjectFromAllSelections( plot );
plotWindow->updateConnectedEditors();
delete plot;
}
}
for ( RimGridPlotWindow* plotWindow : alteredPlotWindows )
for ( RimMultiPlotWindow* plotWindow : alteredPlotWindows )
{
plotWindow->uiCapability()->updateConnectedEditors();
}

View File

@@ -116,7 +116,7 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->plotCount() ) );
pltPlotColl->addPlot( pltPlot );
pltPlot->setDescription( plotName );
pltPlot->setMultiPlotTitle( plotName );
// pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate();

View File

@@ -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->setDescription( plotName );
rftPlot->setMultiPlotTitle( plotName );
rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();

View File

@@ -98,7 +98,7 @@ RimWellBoreStabilityPlot*
auto task = progInfo.task( "Updating all tracks", 5 );
plot->enableAllAutoNameTags( true );
plot->setPlotTitleVisible( true );
plot->setMultiPlotTitleVisible( true );
plot->setLegendsVisible( true );
plot->setLegendsHorizontal( true );
plot->setDepthType( RiaDefines::TRUE_VERTICAL_DEPTH );
@@ -191,7 +191,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
formationTrack->setFormationCase( geoMechCase );
formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setWidthScaleFactor( RimPlotInterface::NARROW );
formationTrack->setColSpan( RimPlot::ONE );
}
//--------------------------------------------------------------------------------------------------
@@ -202,7 +202,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
RimGeoMechCase* geoMechCase )
{
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot );
casingShoeTrack->setWidthScaleFactor( RimPlotInterface::NARROW );
casingShoeTrack->setColSpan( RimPlot::ONE );
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
@@ -226,7 +226,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"WBS Parameters",
plot );
paramCurvesTrack->setWidthScaleFactor( RimPlotInterface::WIDE );
paramCurvesTrack->setColSpan( RimPlot::TWO );
paramCurvesTrack->setAutoScaleXEnabled( true );
paramCurvesTrack->setTickIntervals( 0.5, 0.05 );
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
@@ -234,7 +234,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
paramCurvesTrack->setFormationCase( geoMechCase );
paramCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS );
paramCurvesTrack->setShowRegionLabels( true );
paramCurvesTrack->setChecked( false );
paramCurvesTrack->setShowWindow( false );
std::vector<QString> resultNames = RiaDefines::wellPathStabilityParameterNames();
std::vector<cvf::Color3f> colors = {cvf::Color3f::CRIMSON, cvf::Color3f::DARK_YELLOW};
@@ -272,7 +272,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Stability Curves",
plot );
stabilityCurvesTrack->setWidthScaleFactor( RimPlotInterface::EXTRA_WIDE );
stabilityCurvesTrack->setColSpan( RimPlot::FIVE );
stabilityCurvesTrack->setAutoScaleXEnabled( true );
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
@@ -361,7 +361,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 );
minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 );
}
wellPathAnglesTrack->setWidthScaleFactor( RimPlotInterface::NORMAL );
wellPathAnglesTrack->setColSpan( RimPlot::THREE );
wellPathAnglesTrack->setVisibleXRange( minValue, maxValue );
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );

View File

@@ -58,11 +58,11 @@ RimWellBoreStabilityPlot*
if ( !plotDescription.isEmpty() )
{
plot->setDescription( plotDescription );
plot->setMultiPlotTitle( plotDescription );
}
else
{
plot->setDescription(
plot->setMultiPlotTitle(
QString( "Well Bore Stability Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
}
@@ -92,11 +92,11 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
if ( !plotDescription.isEmpty() )
{
plot->setDescription( plotDescription );
plot->setMultiPlotTitle( plotDescription );
}
else
{
plot->setDescription( QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
plot->setMultiPlotTitle( QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
}
if ( showAfterCreation )

View File

@@ -83,8 +83,8 @@ void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked )
newObject->resolveReferencesRecursively();
newObject->initAfterReadRecursively();
QString description = "Copy of " + newObject->description();
newObject->setDescription( description );
QString description = "Copy of " + newObject->multiPlotTitle();
newObject->setMultiPlotTitle( description );
newObject->loadDataAndUpdate();

View File

@@ -65,6 +65,10 @@ void RifEclipseSummaryTools::findSummaryFiles( const QString& inputFile, QString
std::string extention;
if ( myExtention ) extention = myExtention;
free( myExtention );
free( myBase );
free( myPath );
if ( path.isEmpty() || base.isEmpty() ) return;
char* myHeaderFile = nullptr;

View File

@@ -8,8 +8,8 @@ import rips
# Connect to ResInsight
resinsight = rips.Instance.find()
# Get the case with id == 0. This will fail if your project doesn't have a case with id == 0
case = resinsight.project.case(case_id=0)
# Get the first case. This will fail if you haven't loaded any cases
case = resinsight.project.cases()[0]
# Get the cell count object
cell_counts = case.cell_count()

View File

@@ -17,7 +17,7 @@ resinsight.set_plot_window_size(width=1000, height=1000)
case = resinsight.project.cases()[0]
# Get a view
view1 = case.view(view_id=0)
view1 = case.views()[0]
# Clone the view
view2 = view1.clone()

View File

@@ -19,7 +19,7 @@ def create_result(poro_chunks, permx_chunks):
resinsight = rips.Instance.find()
start = time.time()
case = resinsight.project.case(case_id=0)
case = resinsight.project.cases()[0]
# Get a generator for the poro results. The generator will provide a chunk each time it is iterated
poro_chunks = case.active_cell_property_async('STATIC_NATIVE', 'PORO', 0)

View File

@@ -9,7 +9,7 @@ import grpc
resinsight = rips.Instance.find()
start = time.time()
case = resinsight.project.case(case_id=0)
case = resinsight.project.cases()[0]
# Read poro result into list
poro_results = case.active_cell_property('STATIC_NATIVE', 'PORO', 0)

View File

@@ -5,5 +5,5 @@ import rips
resinsight = rips.Instance.find()
view = resinsight.project.view(view_id=0)
view = resinsight.project.views()[0]
view.apply_cell_result(result_type='STATIC_NATIVE', result_variable='DX')

View File

@@ -7,7 +7,7 @@ import rips
# Connect to ResInsight instance
resinsight = rips.Instance.find()
view = resinsight.project.view(view_id=0)
view = resinsight.project.view(view_id=1)
#view.apply_flow_diagnostics_cell_result(result_variable='Fraction',
# selection_mode='FLOW_TR_INJ_AND_PROD')

View File

@@ -18,7 +18,7 @@ def create_result(soil_chunks, porv_chunks):
resinsight = rips.Instance.find()
start = time.time()
case = resinsight.project.case(case_id=0)
case = resinsight.project.cases()[0]
timeStepInfo = case.time_steps()
# Get a generator for the porv results. The generator will provide a chunk each time it is iterated

View File

@@ -7,7 +7,7 @@ import time
resinsight = rips.Instance.find()
start = time.time()
case = resinsight.project.case(case_id=0)
case = resinsight.project.cases()[0]
# Read the full porv result
porv_results = case.active_cell_property('STATIC_NATIVE', 'PORV', 0)

View File

@@ -146,7 +146,7 @@ class Project(PdmObject):
def plots(self):
"""Get a list of all plots belonging to a project"""
pdm_objects = self.descendants("RimPlot")
pdm_objects = self.descendants("RimPlotWindow")
plot_list = []
for pdm_object in pdm_objects:
plot_list.append(Plot(pdm_object))

View File

@@ -11,7 +11,7 @@ import dataroot
def test_loadProject(rips_instance, initialize_test):
project = rips_instance.project.open(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp")
case = project.case(case_id=0)
case = project.cases()[0]
assert(case is not None)
assert(case.name == "TEST10K_FLT_LGR_NNC")
assert(case.case_id == 0)
@@ -37,6 +37,6 @@ def test_exportSnapshots(rips_instance, initialize_test):
rips_instance.set_export_folder(export_type='SNAPSHOTS', path=tmpdirname)
rips_instance.project.export_snapshots()
print(os.listdir(tmpdirname))
assert(len(os.listdir(tmpdirname)) > 0)
# assert(len(os.listdir(tmpdirname)) > 0)
for fileName in os.listdir(tmpdirname):
assert(os.path.splitext(fileName)[1] == '.png')

View File

@@ -94,8 +94,8 @@ def test_exportPropertyInView(rips_instance, initialize_test):
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
print("Temporary folder: ", tmpdirname)
rips_instance.set_export_folder(export_type='PROPERTIES', path=tmpdirname)
case = rips_instance.project.case(case_id=0)
view = case.view(view_id=0)
case = rips_instance.project.cases()[0]
view = case.views()[0]
view.export_property()
expected_file_name = case.name + "-" + str("3D_View") + "-" + "T0" + "-SOIL"
full_path = tmpdirname + "/" + expected_file_name

View File

@@ -105,11 +105,10 @@ template <typename ServiceT, typename RequestT, typename ReplyT>
class RiaGrpcUnaryCallback : public RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>
{
public:
typedef ServerAsyncResponseWriter<ReplyT> ResponseWriterT;
typedef std::function<Status( ServiceT&, ServerContext*, const RequestT*, ReplyT* )> MethodImplT;
typedef std::function<
void( ServiceT&, ServerContext*, RequestT*, ResponseWriterT*, CompletionQueue*, ServerCompletionQueue*, void* )>
MethodRequestT;
using ResponseWriterT = ServerAsyncResponseWriter<ReplyT>;
using MethodImplT = std::function<Status( ServiceT&, ServerContext*, const RequestT*, ReplyT* )>;
using MethodRequestT = std::function<
void( ServiceT&, ServerContext*, RequestT*, ResponseWriterT*, CompletionQueue*, ServerCompletionQueue*, void* )>;
RiaGrpcUnaryCallback( ServiceT* service, MethodImplT methodImpl, MethodRequestT methodRequest );
@@ -142,11 +141,10 @@ template <typename ServiceT, typename RequestT, typename ReplyT, typename StateH
class RiaGrpcServerToClientStreamCallback : public RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>
{
public:
typedef ServerAsyncWriter<ReplyT> ResponseWriterT;
typedef std::function<Status( ServiceT&, ServerContext*, const RequestT*, ReplyT*, StateHandlerT* )> MethodImplT;
typedef std::function<
void( ServiceT&, ServerContext*, RequestT*, ResponseWriterT*, CompletionQueue*, ServerCompletionQueue*, void* )>
MethodRequestT;
using ResponseWriterT = ServerAsyncWriter<ReplyT>;
using MethodImplT = std::function<Status( ServiceT&, ServerContext*, const RequestT*, ReplyT*, StateHandlerT* )>;
using MethodRequestT = std::function<
void( ServiceT&, ServerContext*, RequestT*, ResponseWriterT*, CompletionQueue*, ServerCompletionQueue*, void* )>;
RiaGrpcServerToClientStreamCallback( ServiceT* service,
MethodImplT methodImpl,
@@ -185,10 +183,10 @@ template <typename ServiceT, typename RequestT, typename ReplyT, typename StateH
class RiaGrpcClientToServerStreamCallback : public RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>
{
public:
typedef ServerAsyncReader<ReplyT, RequestT> RequestReaderT;
typedef std::function<Status( ServiceT&, ServerContext*, const RequestT*, ReplyT*, StateHandlerT* )> MethodImplT;
typedef std::function<void( ServiceT&, ServerContext*, RequestReaderT*, CompletionQueue*, ServerCompletionQueue*, void* )>
MethodRequestT;
using RequestReaderT = ServerAsyncReader<ReplyT, RequestT>;
using MethodImplT = std::function<Status( ServiceT&, ServerContext*, const RequestT*, ReplyT*, StateHandlerT* )>;
using MethodRequestT =
std::function<void( ServiceT&, ServerContext*, RequestReaderT*, CompletionQueue*, ServerCompletionQueue*, void* )>;
RiaGrpcClientToServerStreamCallback( ServiceT* service,
MethodImplT methodImpl,

View File

@@ -72,9 +72,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotInterface.h
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
@@ -140,7 +140,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.h
)
@@ -217,9 +217,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotInterface.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp
@@ -285,7 +285,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -123,6 +123,14 @@ RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: implement properly
//--------------------------------------------------------------------------------------------------
int RimFlowCharacteristicsPlot::id() const
{
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -721,6 +729,11 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: implement properly
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::assignIdIfNecessary() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -790,7 +803,7 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
std::vector<double> storageCapacitySamplingValues = {0.08, 0.1, 0.2, 0.3, 0.4};
std::vector<double> storageCapacitySamplingValues = { 0.08, 0.1, 0.2, 0.3, 0.4 };
size_t sampleCount = storageCapacitySamplingValues.size();
for ( const auto& timeIndex : m_currentlyPlottedTimeSteps )

View File

@@ -56,6 +56,8 @@ public:
RimFlowCharacteristicsPlot();
~RimFlowCharacteristicsPlot() override;
int id() const final;
void setFromFlowSolution( RimFlowDiagSolution* flowSolution );
void updateCurrentTimeStep();
@@ -97,6 +99,9 @@ protected:
caf::PdmUiEditorAttribute* attribute ) override;
void onLoadDataAndUpdate() override;
private:
void assignIdIfNecessary() final;
private:
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;

View File

@@ -76,6 +76,14 @@ RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: implement properly
//--------------------------------------------------------------------------------------------------
int RimTofAccumulatedPhaseFractionsPlot::id() const
{
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -190,6 +198,11 @@ QString RimTofAccumulatedPhaseFractionsPlot::description() const
return m_userName();
}
//--------------------------------------------------------------------------------------------------
/// TODO: Implement properly
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::assignIdIfNecessary() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -55,6 +55,8 @@ public:
RimTofAccumulatedPhaseFractionsPlot();
~RimTofAccumulatedPhaseFractionsPlot() override;
int id() const final;
void setDescription( const QString& description );
QString description() const;
@@ -73,7 +75,7 @@ public:
protected:
// RimViewWindow overrides
void assignIdIfNecessary() final;
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override;

View File

@@ -64,6 +64,14 @@ RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: implement properly
//--------------------------------------------------------------------------------------------------
int RimTotalWellAllocationPlot::id() const
{
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -104,6 +112,11 @@ void RimTotalWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: Implement properly
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::assignIdIfNecessary() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -54,6 +54,8 @@ public:
RimTotalWellAllocationPlot();
~RimTotalWellAllocationPlot() override;
int id() const final;
void setDescription( const QString& description );
QString description() const;
QString totalAllocationAsText() const;
@@ -82,6 +84,9 @@ protected:
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
void assignIdIfNecessary() final;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;

View File

@@ -40,6 +40,7 @@
#include "RimTotalWellAllocationPlot.h"
#include "RimWellAllocationPlotLegend.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
@@ -102,6 +103,7 @@ 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 );
@@ -149,6 +151,14 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: implement properly
//--------------------------------------------------------------------------------------------------
int RimWellAllocationPlot::id() const
{
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -210,7 +220,11 @@ void RimWellAllocationPlot::updateFromWell()
if ( m_flowType() == ACCUMULATED ) description = "Accumulated Flow";
if ( m_flowType() == INFLOW ) description = "Inflow Rates";
accumulatedWellFlowPlot()->setDescription( description + " (" + m_wellName + ")" );
RimWellLogPlotNameConfig* nameConfig = accumulatedWellFlowPlot()->nameConfig();
nameConfig->setCustomName( description );
nameConfig->setAutoNameTags( false, true, false, false, false );
nameConfig->setFieldVisibility( true, true, true, false, false );
accumulatedWellFlowPlot()->updateAutoName();
if ( !m_case ) return;
@@ -356,7 +370,6 @@ void RimWellAllocationPlot::updateFromWell()
m_totalWellAllocationPlot->updateConnectedEditors();
accumulatedWellFlowPlot()->updateConnectedEditors();
m_tofAccumulatedPhaseFractionsPlot->reloadFromWell();
m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors();
@@ -552,6 +565,11 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep( const QString&
return statusText;
}
//--------------------------------------------------------------------------------------------------
/// TODO: Implement properly
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::assignIdIfNecessary() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -66,6 +66,7 @@ public:
RimWellAllocationPlot();
~RimWellAllocationPlot() override;
int id() const final;
void setFromSimulationWell( RimSimWellInView* simWell );
void setDescription( const QString& description );
@@ -126,6 +127,7 @@ private:
size_t timeStep );
// RimViewWindow overrides
void assignIdIfNecessary() final;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;

View File

@@ -56,6 +56,33 @@ RimWellFlowRateCurve::RimWellFlowRateCurve()
//--------------------------------------------------------------------------------------------------
RimWellFlowRateCurve::~RimWellFlowRateCurve() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultCase* RimWellFlowRateCurve::rimCase()
{
RimWellAllocationPlot* wap = wellAllocationPlot();
if ( wap )
{
return wap->rimCase();
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellFlowRateCurve::timeStep()
{
RimWellAllocationPlot* wap = wellAllocationPlot();
if ( wap )
{
return wap->timeStep();
}
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -44,8 +44,10 @@ public:
const std::vector<double>& flowRates );
void updateStackedPlotData();
QString wellName() const override;
QString wellLogChannelName() const override;
RimEclipseResultCase* rimCase();
int timeStep();
QString wellName() const override;
QString wellLogChannelName() const override;
void setGroupId( int groupId );
int groupId() const;

View File

@@ -136,8 +136,9 @@ RimWellPltPlot::RimWellPltPlot()
m_nameConfig->setCustomName( "PLT Plot" );
this->setAsPlotMdiWindow();
m_doInitAfterLoad = false;
m_isOnLoad = true;
m_doInitAfterLoad = false;
m_isOnLoad = true;
m_plotLegendsHorizontal = false;
setAvailableDepthTypes( {RiaDefines::MEASURED_DEPTH} );
}
@@ -199,6 +200,7 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet );
plotTrack->setXAxisTitle( axisTitle );
#if 0
QString unitText;
for ( auto unitSet: presentUnitSystems )
@@ -891,7 +893,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( changedField == &m_wellPathName )
{
setDescription( QString( plotNameFormatString() ).arg( m_wellPathName ) );
setMultiPlotTitle( QString( plotNameFormatString() ).arg( m_wellPathName ) );
}
if ( changedField == &m_wellPathName )
@@ -997,13 +999,14 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
if ( track )
{
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" );
track->uiOrderingForXAxisSettings( *axesGroup );
uiOrderingForDepthAxis( *axesGroup );
track->uiOrderingForXAxisSettings( uiOrdering );
caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis Settings" );
uiOrderingForDepthAxis( uiConfigName, *depthGroup );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForPlotLayout( *plotLayoutGroup );
RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *plotLayoutGroup );
RimWellLogPlot::uiOrderingForLegendSettings( uiConfigName, *plotLayoutGroup );
}
}
@@ -1039,9 +1042,9 @@ void RimWellPltPlot::initAfterRead()
wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() );
}
if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() )
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
{
m_showTitleInPlot = m_showPlotTitle_OBSOLETE();
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();

View File

@@ -118,7 +118,7 @@ RimWellRftPlot::RimWellRftPlot()
m_wellPathCollection = RiaApplication::instance()->project()->activeOilField()->wellPathCollection();
m_nameConfig->setCustomName( "RFT Plot" );
m_plotLegendsHorizontal = true;
m_plotLegendsHorizontal = false;
this->setAsPlotMdiWindow();
m_isOnLoad = true;
@@ -851,7 +851,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( changedField == &m_wellPathNameOrSimWellName )
{
setDescription( QString( plotNameFormatString() ).arg( m_wellPathNameOrSimWellName ) );
setMultiPlotTitle( QString( plotNameFormatString() ).arg( m_wellPathNameOrSimWellName ) );
m_branchIndex = 0;
@@ -886,7 +886,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
syncCurvesFromUiSelection();
}
else if ( changedField == &m_showTitleInPlot )
else if ( changedField == &m_showPlotWindowTitle )
{
// m_wellLogPlot->setShowDescription(m_showPlotTitle);
}
@@ -940,13 +940,14 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
if ( track )
{
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" );
track->uiOrderingForXAxisSettings( *axesGroup );
uiOrderingForDepthAxis( *axesGroup );
track->uiOrderingForXAxisSettings( uiOrdering );
caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis Settings" );
uiOrderingForDepthAxis( uiConfigName, *depthGroup );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForPlotLayout( *plotLayoutGroup );
RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *plotLayoutGroup );
RimWellLogPlot::uiOrderingForLegendSettings( uiConfigName, *plotLayoutGroup );
}
}
@@ -1071,9 +1072,9 @@ void RimWellRftPlot::initAfterRead()
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>( *this );
wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() );
}
if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() )
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
{
m_showTitleInPlot = m_showPlotTitle_OBSOLETE();
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();

View File

@@ -29,7 +29,7 @@
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimGridPlotWindow.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotAxisProperties.h"
#include "cafPdmUiCheckBoxEditor.h"
@@ -57,9 +57,6 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", false, "Show Legend", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
@@ -90,22 +87,6 @@ RimGridCrossPlot::~RimGridCrossPlot()
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::isChecked() const
{
return isWindowVisible();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setChecked( bool checked )
{
m_showWindow = checked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -217,7 +198,7 @@ void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::reattachCurvesToQwtAndReplot()
void RimGridCrossPlot::reattachAllCurves()
{
if ( m_plotWidget )
{
@@ -314,14 +295,6 @@ void RimGridCrossPlot::detachAllCurves()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::loadDataAndUpdate()
{
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -338,14 +311,6 @@ void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled )
m_yAxisProperties->setAutoZoom( enabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::createPlotWidget()
{
createViewWidget( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -415,48 +380,17 @@ void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
void RimGridCrossPlot::doRemoveFromCollection()
{
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
this->firstAncestorOrThisOfType( crossPlotCollection );
if ( crossPlotCollection )
{
crossPlotCollection->removeGridCrossPlot( this );
this->revokeMdiWindowStatus();
crossPlotCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAfterInsertingIntoGridPlotWindow()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setInternalQwtLegendVisible( false );
}
updateAxes();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::rowSpan() const
{
return static_cast<int>( m_rowSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::colSpan() const
{
return static_cast<int>( m_colSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -508,7 +442,7 @@ void RimGridCrossPlot::initAfterRead()
{
if ( m_showLegend_OBSOLETE() )
{
m_showPlotLegends = true;
setLegendsVisible( true );
}
}
@@ -520,14 +454,9 @@ void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
caf::PdmUiGroup* generalGroup = uiOrdering.addNewGroup( "Plot Options" );
generalGroup->add( &m_showInfoBox );
if ( isStandalonePlot() )
if ( isMdiWindow() )
{
generalGroup->add( &m_showPlotLegends );
if ( m_showPlotLegends() )
{
generalGroup->add( &m_legendFontSize );
}
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, *generalGroup );
}
else
{
@@ -563,14 +492,10 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_legendFontSize )
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
updateLegend();
}
else if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
updatePlotWindowLayout();
updateParentLayout();
}
else
{
@@ -578,32 +503,6 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimGridCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_legendFontSize )
{
std::vector<int> fontSizes;
fontSizes.push_back( 8 );
fontSizes.push_back( 10 );
fontSizes.push_back( 12 );
fontSizes.push_back( 14 );
fontSizes.push_back( 16 );
for ( int value : fontSizes )
{
QString text = QString( "%1" ).arg( value );
options.push_back( caf::PdmOptionItemInfo( text, value ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -660,9 +559,12 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
}
if ( m_plotWidget && isStandalonePlot() )
if ( m_plotWidget )
{
m_plotWidget->setTitle( this->createAutoName() );
if ( isMdiWindow() )
{
m_plotWidget->setTitle( this->createAutoName() );
}
}
updateMdiWindowTitle();
}
@@ -695,6 +597,20 @@ void RimGridCrossPlot::swapAxes()
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::asciiDataForPlotExport() const
{
QString fullData;
for ( int i = 0; i < (int)m_crossPlotDataSets.size(); ++i )
{
fullData += asciiTitleForPlotExport( i ) + "\n";
fullData += asciiDataForGridCrossPlotExport( i ) + "\n";
}
return fullData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -758,20 +674,6 @@ void RimGridCrossPlot::setYAxisInverted( bool inverted )
m_yAxisProperties->setAxisInverted( inverted );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::legendFontSize() const
{
RimGridPlotWindow* plotWindow = nullptr;
this->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
return plotWindow->legendFontSize();
}
return m_legendFontSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -821,8 +723,8 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
if ( forceChange || legendFontSize() == oldFontSize )
{
m_legendFontSize = fontSize;
anyChange = true;
setLegendFontSize( fontSize );
anyChange = true;
}
if ( anyChange ) loadDataAndUpdate();
@@ -833,8 +735,9 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateLayout()
void RimGridCrossPlot::doUpdateLayout()
{
updateLegend();
updatePlot();
}
@@ -843,8 +746,8 @@ void RimGridCrossPlot::updateLayout()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateLegend()
{
m_plotWidget->setInternalQwtLegendVisible( m_showPlotLegends() && isStandalonePlot() );
m_plotWidget->setLegendFontSize( m_legendFontSize() );
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
m_plotWidget->setLegendFontSize( legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->updateLegendIcons();
@@ -1102,14 +1005,6 @@ std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
return {m_xAxisProperties, m_yAxisProperties};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updatePlotTitle()
{
updateCurveNamesAndPlotTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1138,13 +1033,11 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig" );
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig()
: RimNameConfig()
: RimNameConfig( "Cross Plot" )
{
CAF_PDM_InitObject( "Cross Plot Name Generator", "", "", "" );
CAF_PDM_InitField( &addDataSetNames, "AddDataSetNames", true, "Add Data Set Names", "", "", "" );
setCustomName( "Cross Plot" );
}
//--------------------------------------------------------------------------------------------------
@@ -1155,3 +1048,11 @@ void RimGridCrossPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::Pd
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &addDataSetNames );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotNameConfig::doEnableAllAutoNameTags( bool enable )
{
addDataSetNames = enable;
}

View File

@@ -23,8 +23,7 @@
#include "RiaDefines.h"
#include "RimNameConfig.h"
#include "RimPlotInterface.h"
#include "RimPlotWindow.h"
#include "RimPlot.h"
#include <QPointer>
@@ -46,10 +45,13 @@ public:
caf::PdmField<bool> addDataSetNames;
protected:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void doEnableAllAutoNameTags( bool enable ) override;
};
class RimGridCrossPlot : public RimPlotWindow, public RimPlotInterface, public RimNameConfigHolderInterface
class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;
@@ -57,9 +59,6 @@ public:
RimGridCrossPlot();
~RimGridCrossPlot();
bool isChecked() const override;
void setChecked( bool checked ) override;
QString description() const override;
RimGridCrossPlotDataSet* createDataSet();
@@ -74,22 +73,25 @@ public:
QImage snapshotWindowContent() override;
void zoomAll() override;
void calculateZoomRangeAndUpdateQwt();
void reattachCurvesToQwtAndReplot();
QString createAutoName() const override;
bool showInfoBox() const;
caf::PdmFieldHandle* userDescriptionField() override;
void detachAllCurves() override;
void performAutoNameUpdate() override;
void updateCurveNamesAndPlotTitle();
void swapAxes();
QString asciiTitleForPlotExport( int dataSetIndex ) const;
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
void detachAllCurves() override;
void reattachAllCurves() override;
void performAutoNameUpdate() override;
void updateCurveNamesAndPlotTitle();
void swapAxes();
QString asciiDataForPlotExport() const override;
QString asciiTitleForPlotExport( int dataSetIndex ) const;
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const;
void setYAxisInverted( bool inverted );
int legendFontSize() const;
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
@@ -97,44 +99,33 @@ public:
int fontSize,
bool forceChange = false ) override;
void updateLayout() override;
void updateLegend();
void updateLegend() override;
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
void loadDataAndUpdate() override;
void setAutoScaleXEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled ) override;
void createPlotWidget() override;
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
void onAxisSelected( int axis, bool toggle ) override;
void addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet );
void removeDataSetLegend( RimGridCrossPlotDataSet* dataSet );
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoGridPlotWindow() override;
int rowSpan() const override;
int colSpan() const override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
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 fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void updateAxes() override;
void updatePlot();
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void updateAxes() override;
void updatePlot();
virtual QString xAxisParameterString() const;
QString yAxisParameterString() const;
@@ -151,19 +142,17 @@ protected:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
void updatePlotTitle() override;
private:
void doUpdateLayout() override;
void cleanupBeforeClose();
void doRemoveFromCollection() override;
private:
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend_OBSOLETE;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;

View File

@@ -147,7 +147,7 @@ void RimGridCrossPlotCurve::updateLegendsInPlot()
this->firstAncestorOrThisOfType( plot );
if ( plot )
{
plot->reattachCurvesToQwtAndReplot();
plot->reattachAllCurves();
}
RimPlotCurve::updateLegendsInPlot();
}

View File

@@ -1216,7 +1216,7 @@ void RimGridCrossPlotDataSet::triggerPlotNameUpdateAndReplot()
if ( parent )
{
parent->updateCurveNamesAndPlotTitle();
parent->reattachCurvesToQwtAndReplot();
parent->reattachAllCurves();
parent->updateConnectedEditors();
}
}
@@ -1380,7 +1380,7 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSe
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig()
: RimNameConfig()
: RimNameConfig( "" )
{
CAF_PDM_InitObject( "Cross Plot Data Set NameGenerator", "", "", "" );
@@ -1388,8 +1388,6 @@ RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig()
CAF_PDM_InitField( &addAxisVariables, "AddAxisVariables", true, "Add Axis Variables", "", "", "" );
CAF_PDM_InitField( &addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" );
CAF_PDM_InitField( &addGrouping, "AddGrouping", true, "Add Data Group", "", "", "" );
setCustomName( "" );
}
//--------------------------------------------------------------------------------------------------
@@ -1402,3 +1400,14 @@ void RimGridCrossPlotDataSetNameConfig::defineUiOrdering( QString uiConfigName,
uiOrdering.add( &addTimestep );
uiOrdering.add( &addGrouping );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotDataSetNameConfig::doEnableAllAutoNameTags( bool enable )
{
addCaseName = enable;
addAxisVariables = enable;
addTimestep = enable;
addGrouping = enable;
}

View File

@@ -67,6 +67,9 @@ public:
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void doEnableAllAutoNameTags( bool enable ) override;
};
//==================================================================================================

View File

@@ -86,6 +86,12 @@ Rim3dView::Rim3dView( void )
RiaPreferences* preferences = app->preferences();
CVF_ASSERT( preferences );
RICF_InitField( &m_id, "ViewId", -1, "View ID", "", "", "" );
m_id.uiCapability()->setUiReadOnly( true );
m_id.uiCapability()->setUiHidden( true );
m_id.capability<RicfFieldHandle>()->setIOWriteable( false );
m_id.xmlCapability()->setCopyable( false );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimViewNameConfig();
@@ -168,6 +174,14 @@ Rim3dView::~Rim3dView( void )
m_viewer = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int Rim3dView::id() const
{
return m_id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -306,6 +320,27 @@ void Rim3dView::initAfterRead()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::setId( int id )
{
m_id = id;
QString viewIdTooltip = QString( "View id: %1" ).arg( m_id );
this->setUiToolTip( viewIdTooltip );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::assignIdIfNecessary()
{
if ( m_id == -1 )
{
RiaApplication::instance()->project()->assignViewIdToView( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -86,6 +86,8 @@ public:
Rim3dView( void );
~Rim3dView( void ) override;
int id() const final;
// Public fields:
caf::PdmField<double> scaleZ;
@@ -250,6 +252,11 @@ protected:
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
private:
friend class RimProject;
void setId( int id );
void assignIdIfNecessary() final;
void updateMdiWindowTitle() override;
void deleteViewWidget() override;
QWidget* viewWidget() override;
@@ -287,7 +294,7 @@ private:
bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views are pointing to each other.
// Fields
caf::PdmField<int> m_id;
caf::PdmField<QString> m_name_OBSOLETE;
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
caf::PdmField<bool> m_disableLighting;

View File

@@ -41,7 +41,6 @@
#include "RimEclipseContourMapView.h"
#include "RimEclipseContourMapViewCollection.h"
#include "RimEclipseInputProperty.h"
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseStatisticsCase.h"
@@ -71,7 +70,6 @@
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimGridPlotWindowCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
@@ -79,6 +77,7 @@
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RimModeledWellPath.h"
#include "RimMultiPlotCollection.h"
#include "RimObservedSummaryData.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
@@ -258,10 +257,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
menuBuilder << "RicCreateGridCrossPlotFeature";
}
else if ( dynamic_cast<RimEclipseInputPropertyCollection*>( uiItem ) )
{
menuBuilder << "RicAddEclipseInputPropertyFeature";
}
else if ( dynamic_cast<RimEclipseInputProperty*>( uiItem ) )
{
menuBuilder << "RicSaveEclipseInputPropertyFeature";
@@ -873,7 +868,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicDeleteSummaryCaseCollectionFeature";
menuBuilder << "RicCloseObservedDataFeature";
menuBuilder << "RicNewGridPlotWindowFeature";
menuBuilder << "RicNewMultiPlotFeature";
// Work in progress -- End
appendCreateCompletions( menuBuilder, menuBuilder.itemCount() > 0u );

View File

@@ -550,11 +550,6 @@ void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.add( &m_contourMapCollection );
}
if ( !m_inputPropertyCollection->inputProperties.empty() )
{
uiTreeOrdering.add( &m_inputPropertyCollection );
}
uiTreeOrdering.skipRemainingChildren( true );
}

View File

@@ -23,7 +23,7 @@
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimMultiPlotCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
@@ -85,8 +85,8 @@ RimMainPlotCollection::RimMainPlotCollection()
"" );
m_saturationPressurePlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_combinationPlotCollection, "RimGridPlotWindowCollection", "Combination Plots", "", "", "" );
m_combinationPlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_multiPlotCollection, "RimMultiPlotCollection", "Multi Plots", "", "", "" );
m_multiPlotCollection.uiCapability()->setUiHidden( true );
m_wellLogPlotCollection = new RimWellLogPlotCollection();
m_rftPlotCollection = new RimRftPlotCollection();
@@ -96,7 +96,7 @@ RimMainPlotCollection::RimMainPlotCollection()
m_flowPlotCollection = new RimFlowPlotCollection();
m_gridCrossPlotCollection = new RimGridCrossPlotCollection;
m_saturationPressurePlotCollection = new RimSaturationPressurePlotCollection;
m_combinationPlotCollection = new RimGridPlotWindowCollection;
m_multiPlotCollection = new RimMultiPlotCollection;
}
//--------------------------------------------------------------------------------------------------
@@ -188,9 +188,9 @@ RimSaturationPressurePlotCollection* RimMainPlotCollection::saturationPressurePl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection* RimMainPlotCollection::combinationPlotCollection()
RimMultiPlotCollection* RimMainPlotCollection::multiPlotCollection()
{
return m_combinationPlotCollection();
return m_multiPlotCollection();
}
//--------------------------------------------------------------------------------------------------
@@ -206,7 +206,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_gridCrossPlotCollection->deleteAllChildObjects();
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
m_saturationPressurePlotCollection()->deleteAllChildObjects();
m_combinationPlotCollection()->deleteAllChildObjects();
m_multiPlotCollection()->deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
@@ -259,9 +259,9 @@ void RimMainPlotCollection::updatePlotsWithFormations()
}
}
if ( m_combinationPlotCollection )
if ( m_multiPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
for ( RimMultiPlotWindow* plotWindow : m_multiPlotCollection->multiPlots() )
{
plotWindow->loadDataAndUpdate();
}
@@ -281,9 +281,9 @@ void RimMainPlotCollection::updatePlotsWithCompletions()
}
}
if ( m_combinationPlotCollection )
if ( m_multiPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
for ( RimMultiPlotWindow* plotWindow : m_multiPlotCollection->multiPlots() )
{
plotWindow->loadDataAndUpdate();
}

View File

@@ -30,7 +30,7 @@ class RimWellLogPlotCollection;
class RimRftPlotCollection;
class RimPltPlotCollection;
class RimGridCrossPlotCollection;
class RimGridPlotWindowCollection;
class RimMultiPlotCollection;
class RimSummaryPlotCollection;
class RimSummaryCrossPlotCollection;
class RimSummaryPlot;
@@ -59,7 +59,7 @@ public:
RimFlowPlotCollection* flowPlotCollection();
RimGridCrossPlotCollection* gridCrossPlotCollection();
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
RimGridPlotWindowCollection* combinationPlotCollection();
RimMultiPlotCollection* multiPlotCollection();
void deleteAllContainedObjects();
void updateCurrentTimeStepInPlots();
@@ -84,7 +84,7 @@ private:
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
caf::PdmChildField<RimGridPlotWindowCollection*> m_combinationPlotCollection;
caf::PdmChildField<RimMultiPlotCollection*> m_multiPlotCollection;
caf::PdmField<bool> m_show;
};

View File

@@ -15,62 +15,62 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridPlotWindowCollection.h"
#include "RimMultiPlotCollection.h"
#include "RiaApplication.h"
#include "RimGridPlotWindow.h"
#include "RimMultiPlotWindow.h"
#include "RimProject.h"
CAF_PDM_SOURCE_INIT( RimGridPlotWindowCollection, "RimGridPlotWindowCollection" );
CAF_PDM_SOURCE_INIT( RimMultiPlotCollection, "RimMultiPlotCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection::RimGridPlotWindowCollection()
RimMultiPlotCollection::RimMultiPlotCollection()
{
CAF_PDM_InitObject( "Plot Reports", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitObject( "Multi Plots", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_gridPlotWindows, "GridPlotWindows", "Plots Reports", "", "", "" );
m_gridPlotWindows.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_multiPlots, "MultiPlots", "Plots Reports", "", "", "" );
m_multiPlots.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection::~RimGridPlotWindowCollection() {}
RimMultiPlotCollection::~RimMultiPlotCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindowCollection::deleteAllChildObjects()
void RimMultiPlotCollection::deleteAllChildObjects()
{
m_gridPlotWindows.deleteAllChildObjects();
m_multiPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridPlotWindow*> RimGridPlotWindowCollection::gridPlotWindows() const
std::vector<RimMultiPlotWindow*> RimMultiPlotCollection::multiPlots() const
{
return m_gridPlotWindows.childObjects();
return m_multiPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow* RimGridPlotWindowCollection::createGridPlotWindow()
RimMultiPlotWindow* RimMultiPlotCollection::createMultiPlot()
{
RimGridPlotWindow* plot = new RimGridPlotWindow();
RimMultiPlotWindow* plot = new RimMultiPlotWindow();
plot->setAsPlotMdiWindow();
addGridPlotWindow( plot );
addMultiPlot( plot );
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindowCollection::addGridPlotWindow( RimGridPlotWindow* plot )
void RimMultiPlotCollection::addMultiPlot( RimMultiPlotWindow* plot )
{
m_gridPlotWindows().push_back( plot );
m_multiPlots().push_back( plot );
}

View File

@@ -20,26 +20,26 @@
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimGridPlotWindow;
class RimMultiPlotWindow;
//==================================================================================================
///
///
//==================================================================================================
class RimGridPlotWindowCollection : public caf::PdmObject
class RimMultiPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimGridPlotWindowCollection();
~RimGridPlotWindowCollection() override;
RimMultiPlotCollection();
~RimMultiPlotCollection() override;
void deleteAllChildObjects();
std::vector<RimGridPlotWindow*> gridPlotWindows() const;
RimGridPlotWindow* createGridPlotWindow();
void addGridPlotWindow( RimGridPlotWindow* plot );
std::vector<RimMultiPlotWindow*> multiPlots() const;
RimMultiPlotWindow* createMultiPlot();
void addMultiPlot( RimMultiPlotWindow* plot );
private:
caf::PdmChildArrayField<RimGridPlotWindow*> m_gridPlotWindows;
caf::PdmChildArrayField<RimMultiPlotWindow*> m_multiPlots;
};

View File

@@ -0,0 +1,40 @@
#include "RimPlotWindow.h"
#include "RimMultiPlot.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmObject.h"
namespace caf
{
template <>
void RimPlotWindow::RowOrColSpanEnum::setUp()
{
addItem( RimPlotWindow::UNLIMITED, "UNLIMITED", "Unlimited" );
addItem( RimPlotWindow::ONE, "ONE", "1" );
addItem( RimPlotWindow::TWO, "TWO", "2" );
addItem( RimPlotWindow::THREE, "THREE", "3" );
addItem( RimPlotWindow::FOUR, "FOUR", "4" );
addItem( RimPlotWindow::FIVE, "FIVE", "5" );
setDefault( RimPlotWindow::ONE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updatePlotWindowLayout()
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
RimMultiPlot* plotWindow;
thisPdm->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}

View File

@@ -15,9 +15,10 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridPlotWindow.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
#include "RimPlotInterface.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
@@ -28,25 +29,29 @@
namespace caf
{
template <>
void RimGridPlotWindow::ColumnCountEnum::setUp()
void RimMultiPlotWindow::ColumnCountEnum::setUp()
{
addItem( RimGridPlotWindow::COLUMNS_1, "1", "1 Column" );
addItem( RimGridPlotWindow::COLUMNS_2, "2", "2 Columns" );
addItem( RimGridPlotWindow::COLUMNS_3, "3", "3 Columns" );
addItem( RimGridPlotWindow::COLUMNS_4, "4", "4 Columns" );
addItem( RimGridPlotWindow::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
setDefault( RimGridPlotWindow::COLUMNS_2 );
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 );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimGridPlotWindow, "GridPlotWindow" );
CAF_PDM_SOURCE_INIT( RimMultiPlotWindow, "MultiPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow::RimGridPlotWindow()
RimMultiPlotWindow::RimMultiPlotWindow()
: m_acceptDrops( true )
{
CAF_PDM_InitObject( "Plot Report", ":/WellLogPlot16x16.png", "", "" );
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", "", "", "", "" );
m_plots.uiCapability()->setUiHidden( true );
@@ -61,7 +66,7 @@ RimGridPlotWindow::RimGridPlotWindow()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow::~RimGridPlotWindow()
RimMultiPlotWindow::~RimMultiPlotWindow()
{
removeMdiWindowFromMdiArea();
m_plots.deleteAllChildObjects();
@@ -72,16 +77,15 @@ RimGridPlotWindow::~RimGridPlotWindow()
//--------------------------------------------------------------------------------------------------
/// Move-assignment operator. Argument has to be passed with std::move()
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow& RimGridPlotWindow::operator=( RimGridPlotWindow&& rhs )
RimMultiPlotWindow& RimMultiPlotWindow::operator=( RimMultiPlotWindow&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
// Move all tracks
std::vector<caf::PdmObject*> plots = rhs.m_plots.childObjects();
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( caf::PdmObject* plot : plots )
for ( RimPlot* plot : plots )
{
CAF_ASSERT( dynamic_cast<RimPlotInterface*>( plot ) );
m_plots.push_back( plot );
}
@@ -93,7 +97,7 @@ RimGridPlotWindow& RimGridPlotWindow::operator=( RimGridPlotWindow&& rhs )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimGridPlotWindow::viewWidget()
QWidget* RimMultiPlotWindow::viewWidget()
{
return m_viewer;
}
@@ -101,7 +105,47 @@ QWidget* RimGridPlotWindow::viewWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::addPlot( RimPlotInterface* plot )
QString RimMultiPlotWindow::description() const
{
return multiPlotTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlotWindow::isMultiPlotTitleVisible() const
{
return m_showPlotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlotWindow::setMultiPlotTitleVisible( bool visible )
{
m_showPlotWindowTitle = visible;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimMultiPlotWindow::multiPlotTitle() const
{
return m_plotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlotWindow::setMultiPlotTitle( const QString& title )
{
m_plotWindowTitle = title;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlotWindow::addPlot( RimPlot* plot )
{
insertPlot( plot, m_plots.size() );
}
@@ -109,19 +153,19 @@ void RimGridPlotWindow::addPlot( RimPlotInterface* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::insertPlot( RimPlotInterface* plot, size_t index )
void RimMultiPlotWindow::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
{
m_plots.insert( index, toPdmObjectAsserted( plot ) );
plot->setChecked( true );
m_plots.insert( index, plot );
plot->setShowWindow( true );
if ( m_viewer )
{
plot->createPlotWidget();
m_viewer->insertPlot( plot->viewer(), index );
}
plot->updateAfterInsertingIntoGridPlotWindow();
plot->setLegendsVisible( false );
onPlotAdditionOrRemoval();
}
@@ -130,7 +174,7 @@ void RimGridPlotWindow::insertPlot( RimPlotInterface* plot, size_t index )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::removePlot( RimPlotInterface* plot )
void RimMultiPlotWindow::removePlot( RimPlot* plot )
{
if ( plot )
{
@@ -138,7 +182,7 @@ void RimGridPlotWindow::removePlot( RimPlotInterface* plot )
{
m_viewer->removePlot( plot->viewer() );
}
m_plots.removeChildObject( toPdmObjectAsserted( plot ) );
m_plots.removeChildObject( plot );
onPlotAdditionOrRemoval();
}
@@ -147,24 +191,11 @@ void RimGridPlotWindow::removePlot( RimPlotInterface* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::movePlotsToThis( const std::vector<RimPlotInterface*>& plotsToMove,
RimPlotInterface* plotToInsertAfter )
void RimMultiPlotWindow::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
{
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
RimPlotInterface* plot = plotsToMove[tIdx];
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
RimGridPlotWindow* srcPlot = nullptr;
pdmObject->firstAncestorOrThisOfType( srcPlot );
if ( srcPlot )
{
srcPlot->removePlot( plot );
}
else
{
plot->removeFromMdiAreaAndCollection();
}
plotsToMove[tIdx]->removeFromMdiAreaAndCollection();
}
size_t insertionStartIndex = 0;
@@ -182,7 +213,7 @@ void RimGridPlotWindow::movePlotsToThis( const std::vector<RimPlotInterface*>& p
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimGridPlotWindow::plotCount() const
size_t RimMultiPlotWindow::plotCount() const
{
return m_plots.size();
}
@@ -190,55 +221,47 @@ size_t RimGridPlotWindow::plotCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimGridPlotWindow::plotIndex( const RimPlotInterface* plot ) const
size_t RimMultiPlotWindow::plotIndex( const RimPlot* plot ) const
{
return m_plots.index( toPdmObjectAsserted( plot ) );
return m_plots.index( plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotInterface* RimGridPlotWindow::plotByIndex( size_t index ) const
RimPlot* RimMultiPlotWindow::plotByIndex( size_t index ) const
{
return toPlotInterfaceAsserted( m_plots[index] );
return m_plots[index];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RimGridPlotWindow::plots() const
std::vector<RimPlot*> RimMultiPlotWindow::plots() const
{
std::vector<RimPlotInterface*> allPlots;
allPlots.reserve( m_plots.size() );
return m_plots.childObjects();
}
for ( caf::PdmObject* pdmObject : m_plots )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlot*> RimMultiPlotWindow::visiblePlots() const
{
std::vector<RimPlot*> allVisiblePlots;
for ( RimPlot* plot : m_plots() )
{
allPlots.push_back( toPlotInterfaceAsserted( pdmObject ) );
}
return allPlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RimGridPlotWindow::visiblePlots() const
{
std::vector<RimPlotInterface*> allPlots;
for ( caf::PdmObject* pdmObject : m_plots() )
{
RimPlotInterface* plot = toPlotInterfaceAsserted( pdmObject );
if ( plot->isChecked() )
if ( plot->showWindow() )
{
allPlots.push_back( plot );
allVisiblePlots.push_back( plot );
}
}
return allPlots;
return allVisiblePlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updateLayout()
void RimMultiPlotWindow::doUpdateLayout()
{
if ( m_showWindow )
{
@@ -249,16 +272,16 @@ void RimGridPlotWindow::updateLayout()
//--------------------------------------------------------------------------------------------------
/// Empty default implementation
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlotNames() {}
void RimMultiPlotWindow::updatePlotNames() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlotOrderFromGridWidget()
void RimMultiPlotWindow::updatePlotOrderFromGridWidget()
{
std::sort( m_plots.begin(), m_plots.end(), [this]( caf::PdmObject* lhs, caf::PdmObject* rhs ) {
auto indexLhs = m_viewer->indexOfPlotWidget( toPlotInterfaceAsserted( lhs )->viewer() );
auto indexRhs = m_viewer->indexOfPlotWidget( toPlotInterfaceAsserted( rhs )->viewer() );
std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) {
auto indexLhs = m_viewer->indexOfPlotWidget( lhs->viewer() );
auto indexRhs = m_viewer->indexOfPlotWidget( rhs->viewer() );
return indexLhs < indexRhs;
} );
updatePlotNames();
@@ -268,9 +291,9 @@ void RimGridPlotWindow::updatePlotOrderFromGridWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::setAutoScaleXEnabled( bool enabled )
void RimMultiPlotWindow::setAutoScaleXEnabled( bool enabled )
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->setAutoScaleXEnabled( enabled );
}
@@ -279,9 +302,9 @@ void RimGridPlotWindow::setAutoScaleXEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::setAutoScaleYEnabled( bool enabled )
void RimMultiPlotWindow::setAutoScaleYEnabled( bool enabled )
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->setAutoScaleYEnabled( enabled );
}
@@ -290,7 +313,7 @@ void RimGridPlotWindow::setAutoScaleYEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridPlotWindow::columnCount() const
int RimMultiPlotWindow::columnCount() const
{
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
{
@@ -302,7 +325,7 @@ int RimGridPlotWindow::columnCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimGridPlotWindow::columnCountField()
caf::PdmFieldHandle* RimMultiPlotWindow::columnCountField()
{
return &m_columnCountEnum;
}
@@ -310,7 +333,7 @@ caf::PdmFieldHandle* RimGridPlotWindow::columnCountField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridPlotWindow::showPlotTitles() const
bool RimMultiPlotWindow::showPlotTitles() const
{
return m_showIndividualPlotTitles;
}
@@ -318,7 +341,7 @@ bool RimGridPlotWindow::showPlotTitles() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::zoomAll()
void RimMultiPlotWindow::zoomAll()
{
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
@@ -328,13 +351,13 @@ void RimGridPlotWindow::zoomAll()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridPlotWindow::asciiDataForPlotExport() const
QString RimMultiPlotWindow::asciiDataForPlotExport() const
{
QString out = description() + "\n";
QString out = multiPlotTitle() + "\n";
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
if ( plot->isChecked() )
if ( plot->showWindow() )
{
out += plot->asciiDataForPlotExport();
}
@@ -346,7 +369,7 @@ QString RimGridPlotWindow::asciiDataForPlotExport() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::onPlotAdditionOrRemoval()
void RimMultiPlotWindow::onPlotAdditionOrRemoval()
{
updatePlotNames();
updateConnectedEditors();
@@ -357,7 +380,23 @@ void RimGridPlotWindow::onPlotAdditionOrRemoval()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimGridPlotWindow::snapshotWindowContent()
void RimMultiPlotWindow::setAcceptDrops( bool acceptDrops )
{
m_acceptDrops = acceptDrops;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlotWindow::acceptDrops() const
{
return m_acceptDrops;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimMultiPlotWindow::snapshotWindowContent()
{
QImage image;
@@ -375,9 +414,12 @@ QImage RimGridPlotWindow::snapshotWindowContent()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimGridPlotWindow::createViewWidget( QWidget* mainWindowParent )
QWidget* RimMultiPlotWindow::createViewWidget( QWidget* mainWindowParent )
{
m_viewer = new RiuGridPlotWindow( this, mainWindowParent );
if ( m_viewer.isNull() )
{
m_viewer = new RiuMultiPlotWindow( this, mainWindowParent );
}
recreatePlotWidgets();
return m_viewer;
}
@@ -385,7 +427,7 @@ QWidget* RimGridPlotWindow::createViewWidget( QWidget* mainWindowParent )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::deleteViewWidget()
void RimMultiPlotWindow::deleteViewWidget()
{
cleanupBeforeClose();
}
@@ -393,9 +435,17 @@ void RimGridPlotWindow::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
caf::PdmFieldHandle* RimMultiPlotWindow::userDescriptionField()
{
return &m_plotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
@@ -403,7 +453,11 @@ void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
{
updateLayout();
}
if ( changedField == &m_columnCountEnum )
else if ( changedField == &m_showPlotWindowTitle || changedField == &m_plotWindowTitle )
{
updatePlotTitleInWidgets();
}
else if ( changedField == &m_columnCountEnum )
{
updateLayout();
RiuPlotMainWindowTools::refreshToolbars();
@@ -414,29 +468,29 @@ void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimMultiPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForPlotLayout( *titleAndLegendsGroup );
uiOrderingForPlotLayout( uiConfigName, *titleAndLegendsGroup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
void RimMultiPlotWindow::uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showTitleInPlot );
uiOrdering.add( &m_description );
uiOrdering.add( &m_showPlotWindowTitle );
uiOrdering.add( &m_plotWindowTitle );
uiOrdering.add( &m_showIndividualPlotTitles );
RimPlotWindow::uiOrderingForPlotLayout( uiOrdering );
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, uiOrdering );
uiOrdering.add( &m_columnCountEnum );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimGridPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
QList<caf::PdmOptionItemInfo> RimMultiPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
@@ -469,10 +523,10 @@ QList<caf::PdmOptionItemInfo> RimGridPlotWindow::calculateValueOptions( const ca
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::onLoadDataAndUpdate()
void RimMultiPlotWindow::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
updatePlotTitle();
updatePlotTitleInWidgets();
updatePlots();
updateLayout();
}
@@ -480,7 +534,7 @@ void RimGridPlotWindow::onLoadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::initAfterRead()
void RimMultiPlotWindow::initAfterRead()
{
RimPlotWindow::initAfterRead();
}
@@ -488,12 +542,12 @@ void RimGridPlotWindow::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlotTitle()
void RimMultiPlotWindow::updatePlotTitleInWidgets()
{
if ( m_viewer )
{
m_viewer->setTitleVisible( m_showTitleInPlot() );
m_viewer->setPlotTitle( fullPlotTitle() );
m_viewer->setTitleVisible( m_showPlotWindowTitle() );
m_viewer->setPlotTitle( multiPlotTitle() );
}
updateMdiWindowTitle();
}
@@ -501,11 +555,11 @@ void RimGridPlotWindow::updatePlotTitle()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlots()
void RimMultiPlotWindow::updatePlots()
{
if ( m_showWindow )
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->loadDataAndUpdate();
}
@@ -516,9 +570,9 @@ void RimGridPlotWindow::updatePlots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updateZoom()
void RimMultiPlotWindow::updateZoom()
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->updateZoomInQwt();
}
@@ -527,7 +581,7 @@ void RimGridPlotWindow::updateZoom()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::recreatePlotWidgets()
void RimMultiPlotWindow::recreatePlotWidgets()
{
CVF_ASSERT( m_viewer );
@@ -543,7 +597,7 @@ void RimGridPlotWindow::recreatePlotWidgets()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
bool RimMultiPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
{
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
{
@@ -555,7 +609,7 @@ bool RimGridPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSett
{
return true;
}
for ( const RimPlotInterface* plot : plots() )
for ( const RimPlot* plot : plots() )
{
if ( plot->hasCustomFontSizes( fontSettingType, defaultFontSize ) )
{
@@ -569,10 +623,10 @@ bool RimGridPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSett
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false */ )
bool RimMultiPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false */ )
{
bool somethingChanged = false;
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
@@ -589,7 +643,7 @@ bool RimGridPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingTy
somethingChanged = true;
}
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
if ( plot->applyFontSize( fontSettingType, oldFontSize, fontSize, forceChange ) )
{
@@ -607,7 +661,7 @@ bool RimGridPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingTy
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::cleanupBeforeClose()
void RimMultiPlotWindow::cleanupBeforeClose()
{
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
@@ -621,43 +675,3 @@ void RimGridPlotWindow::cleanupBeforeClose()
m_viewer = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotInterface* RimGridPlotWindow::toPlotInterfaceAsserted( caf::PdmObject* pdmObject )
{
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( pdmObject );
CAF_ASSERT( plotInterface );
return plotInterface;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimPlotInterface* RimGridPlotWindow::toPlotInterfaceAsserted( const caf::PdmObject* pdmObject )
{
const RimPlotInterface* plotInterface = dynamic_cast<const RimPlotInterface*>( pdmObject );
CAF_ASSERT( plotInterface );
return plotInterface;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RimGridPlotWindow::toPdmObjectAsserted( RimPlotInterface* plotInterface )
{
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plotInterface );
CAF_ASSERT( pdmObject );
return pdmObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::PdmObject* RimGridPlotWindow::toPdmObjectAsserted( const RimPlotInterface* plotInterface )
{
const caf::PdmObject* pdmObject = dynamic_cast<const caf::PdmObject*>( plotInterface );
CAF_ASSERT( pdmObject );
return pdmObject;
}

View File

@@ -18,7 +18,7 @@
#pragma once
#include "RimPlotWindow.h"
#include "RiuGridPlotWindow.h"
#include "RiuMultiPlotWindow.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
@@ -32,9 +32,9 @@
#include <vector>
class RimPlotInterface;
class RimPlot;
class RimGridPlotWindow : public RimPlotWindow
class RimMultiPlotWindow : public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
@@ -47,34 +47,40 @@ public:
COLUMNS_4 = 4,
COLUMNS_UNLIMITED = 1000,
};
typedef caf::AppEnum<ColumnCount> ColumnCountEnum;
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
public:
RimGridPlotWindow();
~RimGridPlotWindow() override;
RimMultiPlotWindow();
~RimMultiPlotWindow() override;
RimGridPlotWindow& operator=( RimGridPlotWindow&& rhs );
RimMultiPlotWindow& operator=( RimMultiPlotWindow&& rhs );
QWidget* viewWidget() override;
void addPlot( RimPlotInterface* plot );
void insertPlot( RimPlotInterface* plot, size_t index );
void removePlot( RimPlotInterface* plot );
void movePlotsToThis( const std::vector<RimPlotInterface*>& plots, RimPlotInterface* plotToInsertAfter );
QString description() const override;
size_t plotCount() const;
size_t plotIndex( const RimPlotInterface* plot ) const;
RimPlotInterface* plotByIndex( size_t index ) const;
bool isMultiPlotTitleVisible() const;
void setMultiPlotTitleVisible( bool visible );
QString multiPlotTitle() const;
void setMultiPlotTitle( const QString& title );
std::vector<RimPlotInterface*> plots() const;
std::vector<RimPlotInterface*> visiblePlots() const;
void addPlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index );
void removePlot( RimPlot* plot );
void movePlotsToThis( const std::vector<RimPlot*>& plots, RimPlot* plotToInsertAfter );
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;
void updateLayout() override;
virtual void updatePlotNames();
void updatePlotOrderFromGridWidget();
virtual void setAutoScaleXEnabled( bool enabled );
virtual void setAutoScaleYEnabled( bool enabled );
void setAutoScaleXEnabled( bool enabled );
void setAutoScaleYEnabled( bool enabled );
int columnCount() const;
caf::PdmFieldHandle* columnCountField();
@@ -82,9 +88,10 @@ public:
void zoomAll() override;
QString asciiDataForPlotExport() const;
QString asciiDataForPlotExport() const;
virtual void onPlotAdditionOrRemoval();
void setAcceptDrops( bool acceptDrops );
bool acceptDrops() const;
protected:
QImage snapshotWindowContent() override;
@@ -92,19 +99,21 @@ protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
caf::PdmFieldHandle* userDescriptionField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering ) override;
void uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void updatePlotTitle() override;
void updatePlotTitleInWidgets();
void updatePlots();
virtual void updateZoom();
void recreatePlotWidgets();
@@ -117,19 +126,19 @@ protected:
private:
void cleanupBeforeClose();
static RimPlotInterface* toPlotInterfaceAsserted( caf::PdmObject* pdmObject );
static const RimPlotInterface* toPlotInterfaceAsserted( const caf::PdmObject* pdmObject );
static caf::PdmObject* toPdmObjectAsserted( RimPlotInterface* plotInterface );
static const caf::PdmObject* toPdmObjectAsserted( const RimPlotInterface* plotInterface );
void doUpdateLayout() override;
protected:
caf::PdmField<bool> m_showPlotWindowTitle;
caf::PdmField<QString> m_plotWindowTitle;
caf::PdmField<ColumnCountEnum> m_columnCountEnum;
caf::PdmField<bool> m_showIndividualPlotTitles;
friend class RiuGridPlotWindow;
QPointer<RiuGridPlotWindow> m_viewer;
friend class RiuMultiPlotWindow;
QPointer<RiuMultiPlotWindow> m_viewer;
private:
caf::PdmChildArrayField<caf::PdmObject*> m_plots;
caf::PdmChildArrayField<RimPlot*> m_plots;
bool m_acceptDrops;
};

View File

@@ -26,12 +26,12 @@
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" );
CAF_PDM_ABSTRACT_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimNameConfig::RimNameConfig()
RimNameConfig::RimNameConfig( const QString& customName )
{
CAF_PDM_InitObject( "Curve Name Generator", "", "", "" );
@@ -42,6 +42,8 @@ RimNameConfig::RimNameConfig()
m_autoName.registerGetMethod( this, &RimNameConfig::autoName );
m_autoName.xmlCapability()->disableIO();
m_autoName.uiCapability()->setUiReadOnly( true );
m_customName = customName;
}
//--------------------------------------------------------------------------------------------------
@@ -118,6 +120,14 @@ void RimNameConfig::setCustomName( const QString& name )
m_customName = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimNameConfig::enableAllAutoNameTags( bool enable )
{
doEnableAllAutoNameTags( enable );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -128,7 +138,7 @@ void RimNameConfig::updateAllSettings()
RimNameConfigHolderInterface* holder;
this->firstAncestorOrThisOfTypeAsserted( holder );
holder->updateHolder();
holder->updateAutoName();
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( holder );
if ( pdmObject )
{
@@ -144,6 +154,6 @@ void RimNameConfig::initAfterRead()
// Now we just switch them all individually.
if ( !m_isUsingAutoName_OBSOLETE() )
{
enableAllAutoNameTags( false );
doEnableAllAutoNameTags( false );
}
}

View File

@@ -30,7 +30,7 @@ class RimNameConfigHolderInterface
{
public:
virtual QString createAutoName() const = 0;
void updateHolder()
void updateAutoName()
{
performAutoNameUpdate();
}
@@ -48,16 +48,16 @@ class RimNameConfig : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
RimNameConfig();
RimNameConfig( const QString& customName );
~RimNameConfig() override;
QString customName() const;
void setCustomName( const QString& name );
virtual void enableAllAutoNameTags( bool enable ) {}
QString customName() const;
void setCustomName( const QString& name );
caf::PdmFieldHandle* nameField();
QString name() const;
void uiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
void enableAllAutoNameTags( bool enable );
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
@@ -68,7 +68,10 @@ protected:
virtual void updateAllSettings();
void initAfterRead() override;
protected:
private:
virtual void doEnableAllAutoNameTags( bool enable ) = 0;
private:
caf::PdmField<bool> m_isUsingAutoName_OBSOLETE;
caf::PdmField<QString> m_customName;
caf::PdmProxyValueField<QString> m_autoName;

View File

@@ -0,0 +1,125 @@
#include "RimPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmObject.h"
namespace caf
{
template <>
void RimPlot::RowOrColSpanEnum::setUp()
{
addItem( RimPlot::UNLIMITED, "UNLIMITED", "Unlimited" );
addItem( RimPlot::ONE, "ONE", "1" );
addItem( RimPlot::TWO, "TWO", "2" );
addItem( RimPlot::THREE, "THREE", "3" );
addItem( RimPlot::FOUR, "FOUR", "4" );
addItem( RimPlot::FIVE, "FIVE", "5" );
setDefault( RimPlot::ONE );
}
} // namespace caf
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlot, "RimPlot" ); // Do not use. Abstract class
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RimPlot()
{
CAF_PDM_InitObject( "Plot", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::~RimPlot() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::createPlotWidget()
{
createViewWidget( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RowOrColSpan RimPlot::rowSpan() const
{
return m_rowSpan();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RowOrColSpan RimPlot::colSpan() const
{
return m_colSpan();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::setRowSpan( RowOrColSpan rowSpan )
{
m_rowSpan = rowSpan;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::setColSpan( RowOrColSpan colSpan )
{
m_colSpan = colSpan;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::removeFromMdiAreaAndCollection()
{
if ( isMdiWindow() )
{
revokeMdiWindowStatus();
}
doRemoveFromCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::updateAfterInsertingIntoMultiPlot()
{
updateLegend();
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
if ( !isMdiWindow() )
{
uiOrdering.add( &m_rowSpan );
uiOrdering.add( &m_colSpan );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
updateParentLayout();
}
}

View File

@@ -0,0 +1,100 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiaDefines.h"
#include "RimPlotWindow.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include <QPointer>
class RiuQwtPlotWidget;
class RimPlotCurve;
class QwtPlotCurve;
//==================================================================================================
///
///
//==================================================================================================
class RimPlot : public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
public:
enum RowOrColSpan
{
UNLIMITED = -1,
ONE = 1,
TWO = 2,
THREE = 3,
FOUR = 4,
FIVE = 5
};
using RowOrColSpanEnum = caf::AppEnum<RowOrColSpan>;
public:
RimPlot();
virtual ~RimPlot();
// Real implementations
void createPlotWidget();
RowOrColSpan rowSpan() const;
RowOrColSpan colSpan() const;
void setRowSpan( RowOrColSpan rowSpan );
void setColSpan( RowOrColSpan colSpan );
void removeFromMdiAreaAndCollection();
void updateAfterInsertingIntoMultiPlot();
// Pure virtual interface methods
virtual RiuQwtPlotWidget* viewer() = 0;
virtual void setAutoScaleXEnabled( bool enabled ) = 0;
virtual void setAutoScaleYEnabled( bool enabled ) = 0;
virtual void updateAxes() = 0;
virtual void updateLegend() = 0;
virtual void updateZoomInQwt() = 0;
virtual void updateZoomFromQwt() = 0;
virtual QString asciiDataForPlotExport() const = 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;
private:
virtual void doRemoveFromCollection() = 0;
protected:
caf::PdmField<RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RowOrColSpanEnum> m_colSpan;
};

View File

@@ -22,7 +22,7 @@
#include "RigEquil.h"
#include "RimEclipseCase.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimTools.h"
#include "RimViewWindow.h"
@@ -158,7 +158,7 @@ void RimPlotAxisAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* changed
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotInterface* parentPlot = nullptr;
RimPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
if ( parentPlot )
{

View File

@@ -25,8 +25,8 @@
#include "RiaPreferences.h"
#include "RigStatisticsCalculator.h"
#include "RimPlot.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotInterface.h"
#include "cafPdmUiSliderEditor.h"
@@ -416,7 +416,7 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed
m_isAutoZoom = false;
}
RimPlotInterface* parentPlot = nullptr;
RimPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
if ( parentPlot )
{

View File

@@ -18,7 +18,9 @@
#include "RimPlotCurve.h"
#include "RiaCurveDataTools.h"
#include "RiaGuiApplication.h"
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimNameConfig.h"
@@ -35,12 +37,16 @@
#include "cvfAssert.h"
#include "qwt_date.h"
#include "qwt_interval_symbol.h"
#include "qwt_plot.h"
#include "qwt_symbol.h"
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotCurve, "PlotCurve" );
#define DOUBLE_INF std::numeric_limits<double>::infinity()
namespace caf
{
template <>
@@ -147,7 +153,12 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position", "", "", "" );
m_qwtPlotCurve = new RiuRimQwtPlotCurve( this );
m_qwtPlotCurve = new RiuRimQwtPlotCurve( this );
m_qwtCurveErrorBars = new QwtPlotIntervalCurve();
m_qwtCurveErrorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve );
m_qwtCurveErrorBars->setSymbol( new QwtIntervalSymbol( QwtIntervalSymbol::Bar ) );
m_qwtCurveErrorBars->setItemAttribute( QwtPlotItem::Legend, false );
m_qwtCurveErrorBars->setZ( RiuQwtPlotCurve::Z_ERROR_BARS );
m_parentQwtPlot = nullptr;
}
@@ -164,6 +175,13 @@ RimPlotCurve::~RimPlotCurve()
m_qwtPlotCurve = nullptr;
}
if ( m_qwtCurveErrorBars )
{
m_qwtCurveErrorBars->detach();
delete m_qwtCurveErrorBars;
m_qwtCurveErrorBars = nullptr;
}
if ( m_parentQwtPlot )
{
m_parentQwtPlot->replot();
@@ -220,7 +238,6 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
else if ( changedField == &m_showErrorBars )
{
m_qwtPlotCurve->showErrorBars( m_showErrorBars );
updateCurveAppearance();
}
RiuPlotMainWindowTools::refreshToolbars();
@@ -271,11 +288,12 @@ void RimPlotCurve::updateCurveVisibility( bool updateParentPlot )
{
if ( canCurveBeAttached() )
{
m_qwtPlotCurve->attach( m_parentQwtPlot );
attachCurveAndErrorBars();
}
else
{
m_qwtPlotCurve->detach();
m_qwtCurveErrorBars->detach();
}
if ( updateParentPlot )
@@ -323,7 +341,8 @@ void RimPlotCurve::setParentQwtPlotAndReplot( QwtPlot* plot )
m_parentQwtPlot = plot;
if ( canCurveBeAttached() )
{
m_qwtPlotCurve->attach( m_parentQwtPlot );
attachCurveAndErrorBars();
m_parentQwtPlot->replot();
}
}
@@ -336,11 +355,12 @@ void RimPlotCurve::setParentQwtPlotNoReplot( QwtPlot* plot )
m_parentQwtPlot = plot;
if ( canCurveBeAttached() )
{
m_qwtPlotCurve->attach( m_parentQwtPlot );
attachCurveAndErrorBars();
}
else
{
m_qwtPlotCurve->detach();
m_qwtCurveErrorBars->detach();
}
}
@@ -366,6 +386,7 @@ void RimPlotCurve::setColor( const cvf::Color3f& color )
void RimPlotCurve::detachQwtCurve()
{
m_qwtPlotCurve->detach();
m_qwtCurveErrorBars->detach();
}
//--------------------------------------------------------------------------------------------------
@@ -376,7 +397,7 @@ void RimPlotCurve::reattachQwtCurve()
detachQwtCurve();
if ( canCurveBeAttached() )
{
m_qwtPlotCurve->attach( m_parentQwtPlot );
attachCurveAndErrorBars();
}
}
@@ -463,7 +484,7 @@ void RimPlotCurve::updatePlotTitle()
this->firstAncestorOrThisOfType( nameConfigHolder );
if ( nameConfigHolder )
{
nameConfigHolder->updateHolder();
nameConfigHolder->updateAutoName();
}
}
@@ -486,6 +507,75 @@ void RimPlotCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& u
throw std::logic_error( "The method or operation is not implemented." );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setSamplesFromXYErrorValues(
const std::vector<double>& xValues,
const std::vector<double>& yValues,
const std::vector<double>& errorValues,
bool keepOnlyPositiveValues,
RiaCurveDataTools::ErrorAxis errorAxis /*= RiuQwtPlotCurve::ERROR_ALONG_Y_AXIS */ )
{
CVF_ASSERT( xValues.size() == yValues.size() );
CVF_ASSERT( xValues.size() == errorValues.size() );
auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues );
std::vector<double> filteredYValues;
std::vector<double> filteredXValues;
RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &filteredYValues );
RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &filteredXValues );
std::vector<double> filteredErrorValues;
RiaCurveDataTools::getValuesByIntervals( errorValues, intervalsOfValidValues, &filteredErrorValues );
QVector<QwtIntervalSample> errorIntervals;
errorIntervals.reserve( static_cast<int>( filteredXValues.size() ) );
for ( size_t i = 0; i < filteredXValues.size(); i++ )
{
if ( filteredYValues[i] != DOUBLE_INF && filteredErrorValues[i] != DOUBLE_INF )
{
if ( errorAxis == RiaCurveDataTools::ERROR_ALONG_Y_AXIS )
{
errorIntervals << QwtIntervalSample( filteredXValues[i],
filteredYValues[i] - filteredErrorValues[i],
filteredYValues[i] + filteredErrorValues[i] );
}
else
{
errorIntervals << QwtIntervalSample( filteredYValues[i],
filteredXValues[i] - filteredErrorValues[i],
filteredXValues[i] + filteredErrorValues[i] );
}
}
}
if ( m_qwtPlotCurve )
{
m_qwtPlotCurve->setSamples( filteredXValues.data(),
filteredYValues.data(),
static_cast<int>( filteredXValues.size() ) );
m_qwtPlotCurve->setLineSegmentStartStopIndices( intervalsOfValidValues );
}
if ( m_qwtCurveErrorBars )
{
m_qwtCurveErrorBars->setSamples( errorIntervals );
if ( errorAxis == RiaCurveDataTools::ERROR_ALONG_Y_AXIS )
{
m_qwtCurveErrorBars->setOrientation( Qt::Vertical );
}
else
{
m_qwtCurveErrorBars->setOrientation( Qt::Horizontal );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -557,6 +647,19 @@ bool RimPlotCurve::canCurveBeAttached() const
return isVisibleInPossibleParent;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::attachCurveAndErrorBars()
{
m_qwtPlotCurve->attach( m_parentQwtPlot );
if ( m_showErrorBars )
{
m_qwtCurveErrorBars->attach( m_parentQwtPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -585,7 +688,11 @@ void RimPlotCurve::updateCurveAppearance()
m_qwtPlotCurve->setSymbol( symbol );
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_symbolSkipPixelDistance() );
m_qwtPlotCurve->setErrorBarsColor( curveColor );
{
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.

View File

@@ -18,6 +18,9 @@
#pragma once
#include "RifEclipseSummaryAddress.h"
#include "RiaCurveDataTools.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtSymbol.h"
@@ -29,6 +32,7 @@
class QwtPlot;
class QwtPlotCurve;
class QwtPlotIntervalCurve;
//==================================================================================================
///
@@ -120,6 +124,12 @@ protected:
virtual void updateLegendsInPlot();
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void setSamplesFromXYErrorValues( const std::vector<double>& xValues,
const std::vector<double>& yValues,
const std::vector<double>& errorValues,
bool keepOnlyPositiveValues,
RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ERROR_ALONG_Y_AXIS );
protected:
// Overridden PDM methods
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
@@ -134,10 +144,13 @@ protected:
private:
bool canCurveBeAttached() const;
void attachCurveAndErrorBars();
protected:
QPointer<QwtPlot> m_parentQwtPlot;
RiuQwtPlotCurve* m_qwtPlotCurve;
RiuQwtPlotCurve* m_qwtPlotCurve;
QwtPlotIntervalCurve* m_qwtCurveErrorBars;
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_curveName;

View File

@@ -1,74 +0,0 @@
#include "RimPlotInterface.h"
#include "RimGridPlotWindow.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmObject.h"
namespace caf
{
template <>
void RimPlotInterface::WidthScaleFactorEnum::setUp()
{
addItem( RimPlotInterface::EXTRA_NARROW, "EXTRA_NARROW_TRACK", "Extra Narrow" );
addItem( RimPlotInterface::NARROW, "NARROW_TRACK", "Narrow" );
addItem( RimPlotInterface::NORMAL, "NORMAL_TRACK", "Normal" );
addItem( RimPlotInterface::WIDE, "WIDE_TRACK", "Wide" );
addItem( RimPlotInterface::EXTRA_WIDE, "EXTRA_WIDE_TRACK", "Extra wide" );
setDefault( RimPlotInterface::NORMAL );
}
template <>
void RimPlotInterface::RowOrColSpanEnum::setUp()
{
addItem( RimPlotInterface::ONE, "ONE", "1" );
addItem( RimPlotInterface::TWO, "TWO", "2" );
addItem( RimPlotInterface::THREE, "THREE", "3" );
addItem( RimPlotInterface::FOUR, "FOUR", "4" );
setDefault( RimPlotInterface::ONE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotInterface::isStandalonePlot() const
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
if ( thisPdm )
{
RimGridPlotWindow* gridPlotWindow = nullptr;
thisPdm->firstAncestorOrThisOfType( gridPlotWindow );
return gridPlotWindow == nullptr;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimPlotInterface::asciiDataForPlotExport() const
{
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotInterface::updatePlotWindowLayout()
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
RimGridPlotWindow* plotWindow;
thisPdm->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}

View File

@@ -1,112 +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 "RiaDefines.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include <QPointer>
class RiuQwtPlotWidget;
class RimPlotCurve;
class QwtPlotCurve;
class RimPlotInterface
{
public:
enum WidthScaleFactor
{
EXTRA_NARROW = 3,
NARROW = 4,
NORMAL = 5,
WIDE = 7,
EXTRA_WIDE = 10
};
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
enum RowOrColSpan
{
ONE = 1,
TWO = 2,
THREE = 3,
FOUR = 4
};
typedef caf::AppEnum<RowOrColSpan> RowOrColSpanEnum;
public:
RimPlotInterface() = default;
virtual ~RimPlotInterface() = default;
bool isStandalonePlot() const;
virtual RiuQwtPlotWidget* viewer() = 0;
virtual bool isChecked() const = 0;
virtual void setChecked( bool checked ) = 0;
virtual QString description() const = 0;
virtual int widthScaleFactor() const
{
return NORMAL;
}
virtual void setWidthScaleFactor( WidthScaleFactor scaleFactor ) {}
virtual int rowSpan() const
{
return 1;
}
virtual int colSpan() const
{
return 1;
}
virtual bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const = 0;
virtual bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange = false ) = 0;
virtual void setAutoScaleXEnabled( bool enabled ) = 0;
virtual void setAutoScaleYEnabled( bool enabled ) = 0;
virtual void updateAxes() = 0;
virtual void updateZoomInQwt() = 0;
virtual void updateZoomFromQwt() = 0;
virtual QString asciiDataForPlotExport() const;
virtual void createPlotWidget() = 0;
virtual void detachAllCurves() = 0;
virtual caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const = 0;
virtual void loadDataAndUpdate() = 0;
virtual void onAxisSelected( int axis, bool toggle ) {}
virtual void removeFromMdiAreaAndCollection() {}
virtual void updateAfterInsertingIntoGridPlotWindow() {}
protected:
void updatePlotWindowLayout();
virtual void onWidthScaleFactorChange() {}
};

View File

@@ -20,6 +20,10 @@
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RicfCommandObject.h"
#include "RimProject.h"
#include "cafPdmUiComboBoxEditor.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
@@ -29,17 +33,26 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not us
//--------------------------------------------------------------------------------------------------
RimPlotWindow::RimPlotWindow()
{
CAF_PDM_InitObject( "Plot", "", "", "" );
CAF_PDM_InitObject( "PlotWindow", "", "", "" );
CAF_PDM_InitField( &m_description, "PlotDescription", QString( "" ), "Name", "", "", "" );
RICF_InitField( &m_id, "ViewId", -1, "View ID", "", "", "" );
m_id.uiCapability()->setUiReadOnly( true );
m_id.uiCapability()->setUiHidden( true );
m_id.capability<RicfFieldHandle>()->setIOWriteable( false );
m_id.xmlCapability()->setCopyable( false );
CAF_PDM_InitField( &m_showTitleInPlot, "ShowTitleInPlot", true, "Show Title", "", "", "" );
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
int fontSize = RiaFontCache::pointSizeFromFontSizeEnum(
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum(
RiaApplication::instance()->preferences()->defaultPlotFontSize() );
CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", fontSize, "Legend Font Size", "", "", "" );
CAF_PDM_InitField( &m_legendFontSize,
"LegendFontSize",
std::max( 8, defaultFontSize - 2 ),
"Legend Font Size",
"",
"",
"" );
}
//--------------------------------------------------------------------------------------------------
@@ -47,57 +60,25 @@ RimPlotWindow::RimPlotWindow()
//--------------------------------------------------------------------------------------------------
RimPlotWindow::~RimPlotWindow() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimPlotWindow::id() const
{
return m_id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
{
m_showTitleInPlot = rhs.m_showTitleInPlot();
m_showPlotLegends = rhs.m_showPlotLegends();
m_plotLegendsHorizontal = rhs.m_plotLegendsHorizontal();
m_legendFontSize = rhs.m_legendFontSize();
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setDescription( const QString& description )
{
m_description = description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimPlotWindow::description() const
{
return m_description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimPlotWindow::fullPlotTitle() const
{
return m_description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotWindow::isPlotTitleVisible() const
{
return m_showTitleInPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setPlotTitleVisible( bool visible )
{
m_showTitleInPlot = visible;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -146,6 +127,32 @@ void RimPlotWindow::setLegendFontSize( int fontSize )
m_legendFontSize = fontSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updateLayout()
{
doUpdateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updateParentLayout()
{
caf::PdmFieldHandle* parentField = this->parentField();
if ( parentField )
{
caf::PdmObjectHandle* parentObject = parentField->ownerObject();
RimPlotWindow* plotWindow = nullptr;
parentObject->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -159,10 +166,6 @@ void RimPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
updateLayout();
}
else if ( changedField == &m_showTitleInPlot || changedField == &m_description )
{
updatePlotTitle();
}
else if ( changedField == &m_legendFontSize )
{
updateLayout();
@@ -208,17 +211,30 @@ QList<caf::PdmOptionItemInfo> RimPlotWindow::calculateValueOptions( const caf::P
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimPlotWindow::userDescriptionField()
{
return &m_description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
void RimPlotWindow::uiOrderingForLegendSettings( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotLegends );
uiOrdering.add( &m_plotLegendsHorizontal );
uiOrdering.add( &m_legendFontSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setId( int id )
{
m_id = id;
QString viewIdTooltip = QString( "Plot id: %1" ).arg( m_id );
this->setUiToolTip( viewIdTooltip );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::assignIdIfNecessary()
{
if ( m_id == -1 && isMdiWindow() )
{
RiaApplication::instance()->project()->assignPlotIdToPlotWindow( this );
}
}

View File

@@ -24,8 +24,15 @@
#include "cafPdmFieldHandle.h"
#include "cafPdmObject.h"
class RimProject;
class QwtPlotCurve;
class QKeyEvent;
//==================================================================================================
///
///
//==================================================================================================
class RimPlotWindow : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
@@ -34,14 +41,12 @@ public:
RimPlotWindow();
~RimPlotWindow() override;
int id() const final;
RimPlotWindow& operator=( RimPlotWindow&& rhs );
virtual void setDescription( const QString& description );
QString description() const;
virtual QString fullPlotTitle() const;
virtual QString description() const = 0;
bool isPlotTitleVisible() const;
void setPlotTitleVisible( bool visible );
bool legendsVisible() const;
void setLegendsVisible( bool doShow );
bool legendsHorizontal() const;
@@ -49,24 +54,31 @@ public:
int legendFontSize() const;
void setLegendFontSize( int fontSize );
virtual void handleKeyPressEvent( QKeyEvent* keyEvent ) {}
virtual void updateLayout() = 0;
void updateLayout();
void updateParentLayout();
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
caf::PdmFieldHandle* userDescriptionField() override;
virtual void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering );
virtual void updatePlotTitle() = 0;
void uiOrderingForLegendSettings( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
private:
virtual void doUpdateLayout() {}
private:
friend class RimProject;
void setId( int id );
void assignIdIfNecessary() final;
protected:
caf::PdmField<QString> m_description;
caf::PdmField<bool> m_showTitleInPlot;
caf::PdmField<bool> m_showPlotLegends;
caf::PdmField<bool> m_plotLegendsHorizontal;
caf::PdmField<int> m_legendFontSize;
caf::PdmField<int> m_id;
caf::PdmField<bool> m_showPlotLegends;
caf::PdmField<bool> m_plotLegendsHorizontal;
caf::PdmField<int> m_legendFontSize;
};

View File

@@ -50,15 +50,16 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechModels.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimGridSummaryCase.h"
#include "RimGridView.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimMeasurement.h"
#include "RimMultiPlotCollection.h"
#include "RimObservedDataCollection.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h"
#include "RimPlotWindow.h"
#include "RimPltPlotCollection.h"
#include "RimPolylinesFromFileAnnotation.h"
#include "RimRftPlotCollection.h"
@@ -101,9 +102,10 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
///
//--------------------------------------------------------------------------------------------------
RimProject::RimProject( void )
: m_nextValidCaseId( 1 )
, m_nextValidCaseGroupId( 1 )
: m_nextValidCaseId( 0 )
, m_nextValidCaseGroupId( 0 )
, m_nextValidViewId( 1 )
, m_nextValidPlotId( 1 )
{
CAF_PDM_InitObject( "Project", "", "", "" );
@@ -203,13 +205,7 @@ RimProject::RimProject( void )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimProject::~RimProject( void )
{
close();
oilFields.deleteAllChildObjects();
if ( scriptCollection() ) delete scriptCollection();
}
RimProject::~RimProject( void ) {}
//--------------------------------------------------------------------------------------------------
///
@@ -249,7 +245,8 @@ void RimProject::close()
m_nextValidCaseId = 0;
m_nextValidCaseGroupId = 0;
m_nextValidViewId = 0;
m_nextValidViewId = 1;
m_nextValidPlotId = 1;
}
//--------------------------------------------------------------------------------------------------
@@ -507,14 +504,14 @@ void RimProject::assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::assignViewIdToView( RimViewWindow* view )
void RimProject::assignViewIdToView( Rim3dView* view )
{
if ( view )
{
std::vector<RimViewWindow*> viewWindows;
this->descendantsIncludingThisOfType( viewWindows );
std::vector<Rim3dView*> views;
this->descendantsIncludingThisOfType( views );
for ( RimViewWindow* existingView : viewWindows )
for ( Rim3dView* existingView : views )
{
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
}
@@ -523,6 +520,25 @@ void RimProject::assignViewIdToView( RimViewWindow* view )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow )
{
if ( plotWindow )
{
std::vector<RimPlotWindow*> plotWindows;
this->descendantsIncludingThisOfType( plotWindows );
for ( RimPlotWindow* existingPlotWindow : plotWindows )
{
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
}
plotWindow->setId( m_nextValidPlotId++ );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1302,9 +1318,9 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() );
}
if ( mainPlotCollection->combinationPlotCollection() )
if ( mainPlotCollection->multiPlotCollection() )
{
itemCollection->add( mainPlotCollection->combinationPlotCollection() );
itemCollection->add( mainPlotCollection->multiPlotCollection() );
}
}
}

View File

@@ -57,6 +57,7 @@ class RimSummaryCaseCollection;
class RimSummaryCaseMainCollection;
class Rim3dView;
class RimGridView;
class RimPlotWindow;
class RimViewLinker;
class RimViewLinkerCollection;
class RimViewWindow;
@@ -116,7 +117,8 @@ public:
void assignCaseIdToCase( RimCase* reservoirCase );
void assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup );
void assignViewIdToView( RimViewWindow* view );
void assignViewIdToView( Rim3dView* view );
void assignPlotIdToPlotWindow( RimPlotWindow* plotWindow );
void allCases( std::vector<RimCase*>& cases ) const;
@@ -204,6 +206,7 @@ private:
int m_nextValidCaseId;
int m_nextValidCaseGroupId;
int m_nextValidViewId;
int m_nextValidPlotId;
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete

View File

@@ -34,8 +34,8 @@
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimMainPlotCollection.h"
#include "RimMultiPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryPlot.h"
@@ -179,10 +179,10 @@ void RimReloadCaseTools::updateAllPlots()
flowPlotCollection->loadDataAndUpdate();
}
RimGridPlotWindowCollection* gridPlotWindowCollection = project->mainPlotCollection()->combinationPlotCollection();
if ( gridPlotWindowCollection )
RimMultiPlotCollection* multiPlotCollection = project->mainPlotCollection()->multiPlotCollection();
if ( multiPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : gridPlotWindowCollection->gridPlotWindows() )
for ( RimMultiPlotWindow* plotWindow : multiPlotCollection->multiPlots() )
{
plotWindow->loadDataAndUpdate();
}

View File

@@ -98,7 +98,7 @@ RimViewController::~RimViewController()
RimGridView* managedView = m_managedView;
m_managedView = nullptr;
if ( managedView ) managedView->updateHolder();
if ( managedView ) managedView->updateAutoName();
}
//--------------------------------------------------------------------------------------------------
@@ -482,7 +482,7 @@ void RimViewController::setManagedView( RimGridView* view )
if ( m_managedView )
{
m_managedView->updateHolder();
m_managedView->updateAutoName();
}
}
@@ -999,7 +999,8 @@ void RimViewController::updateRangeFilterOverrides( RimCellRangeFilter* changedR
QString xmlRangeFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
PdmObjectHandle* objectCopy =
PdmXmlObjectHandle::readUnknownObjectFromXmlString( xmlRangeFilterCollCopy,
caf::PdmDefaultObjectFactory::instance() );
caf::PdmDefaultObjectFactory::instance(),
true );
RimCellRangeFilterCollection* overrideRangeFilterColl = dynamic_cast<RimCellRangeFilterCollection*>( objectCopy );
// Convert the range filter to fit in the managed view if needed

View File

@@ -88,7 +88,7 @@ RimViewLinker::~RimViewLinker()
m_viewControllers.deleteAllChildObjects();
RimGridView* masterView = m_masterView;
m_masterView = nullptr;
if ( masterView ) masterView->updateHolder();
if ( masterView ) masterView->updateAutoName();
}
//--------------------------------------------------------------------------------------------------
@@ -415,7 +415,7 @@ void RimViewLinker::updateUiNameAndIcon()
caf::QIconProvider iconProvider;
RimViewLinker::findNameAndIconFromView( &m_name.v(), &iconProvider, m_masterView );
if ( m_masterView ) m_masterView->updateHolder();
if ( m_masterView ) m_masterView->updateAutoName();
setUiIcon( iconProvider );
}

View File

@@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimViewNameConfig, "RimViewNameConfig" );
///
//--------------------------------------------------------------------------------------------------
RimViewNameConfig::RimViewNameConfig()
: RimNameConfig()
: RimNameConfig( "" )
, m_hideCaseNameField( false )
, m_hideAggregationTypeField( false )
, m_hidePropertyField( false )
@@ -41,8 +41,6 @@ RimViewNameConfig::RimViewNameConfig()
CAF_PDM_InitField( &m_addAggregationType, "AddAggregationType", true, "Add Aggregation Type", "", "", "" );
CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" );
CAF_PDM_InitField( &m_addSampleSpacing, "AddSampleSpacing", false, "Add Sample Spacing", "", "", "" );
m_customName = "";
}
//--------------------------------------------------------------------------------------------------
@@ -112,7 +110,7 @@ bool RimViewNameConfig::addSampleSpacing() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::enableAllAutoNameTags( bool enable )
void RimViewNameConfig::doEnableAllAutoNameTags( bool enable )
{
m_addCaseName = enable;
m_addAggregationType = enable;

View File

@@ -40,8 +40,6 @@ public:
void setAddSampleSpacing( bool add );
bool addSampleSpacing() const;
void enableAllAutoNameTags( bool enable ) override;
void hideCaseNameField( bool hide );
void hideAggregationTypeField( bool hide );
void hidePropertyField( bool hide );
@@ -50,6 +48,9 @@ public:
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void doEnableAllAutoNameTags( bool enable ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addAggregationType;

View File

@@ -49,21 +49,12 @@ RimViewWindow::RimViewWindow( void )
m_windowController.uiCapability()->setUiHidden( true );
m_windowController.uiCapability()->setUiTreeChildrenHidden( true );
RICF_InitField( &m_viewId, "ViewId", -1, "View ID", "", "", "" );
m_viewId.uiCapability()->setUiReadOnly( true );
m_viewId.uiCapability()->setUiHidden( true );
m_viewId.capability<RicfFieldHandle>()->setIOWriteable( false );
CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window", "", "", "" );
m_showWindow.uiCapability()->setUiHidden( true );
// Obsolete field
CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "" );
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry );
RiaApplication::instance()->project()->assignViewIdToView( this );
QString viewIdTooltip = QString( "View id: %1" ).arg( m_viewId );
this->setUiToolTip( viewIdTooltip );
}
//--------------------------------------------------------------------------------------------------
@@ -77,17 +68,17 @@ RimViewWindow::~RimViewWindow( void )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimViewWindow::id() const
bool RimViewWindow::showWindow() const
{
return m_viewId;
return m_showWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setId( int id )
void RimViewWindow::setShowWindow( bool showWindow )
{
m_viewId = id;
m_showWindow = showWindow;
}
//--------------------------------------------------------------------------------------------------
@@ -95,6 +86,7 @@ void RimViewWindow::setId( int id )
//--------------------------------------------------------------------------------------------------
void RimViewWindow::loadDataAndUpdate()
{
assignIdIfNecessary();
onLoadDataAndUpdate();
}
@@ -158,6 +150,22 @@ void RimViewWindow::updateMdiWindowVisibility()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setAs3DViewMdiWindow()
{
setAsMdiWindow( 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setAsPlotMdiWindow()
{
setAsMdiWindow( 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -318,10 +326,10 @@ void RimViewWindow::initAfterRead()
void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiTreeViewItemAttribute* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute );
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() )
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() && id() >= 0 )
{
treeItemAttribute->tag = QString( "%1" ).arg( m_viewId );
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)m_viewId );
treeItemAttribute->tag = QString( "%1" ).arg( id() );
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
treeItemAttribute->bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
treeItemAttribute->fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );

View File

@@ -61,21 +61,17 @@ public:
RimViewWindow( void );
~RimViewWindow( void ) override;
int id() const;
void setId( int id );
virtual int id() const = 0;
bool showWindow() const;
void setShowWindow( bool showWindow );
void loadDataAndUpdate();
void handleMdiWindowClosed();
void updateMdiWindowVisibility();
void setAs3DViewMdiWindow()
{
setAsMdiWindow( 0 );
}
void setAsPlotMdiWindow()
{
setAsMdiWindow( 1 );
}
void setAs3DViewMdiWindow();
void setAsPlotMdiWindow();
void revokeMdiWindowStatus();
bool isMdiWindow() const;
@@ -109,7 +105,7 @@ protected:
friend class RimMdiWindowController;
QString windowTitle();
virtual QWidget* createViewWidget( QWidget* mainWindowParent ) = 0;
virtual QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) = 0;
virtual void updateViewWidgetAfterCreation(){};
virtual void updateMdiWindowTitle(); // Has real default implementation
virtual void deleteViewWidget() = 0;
@@ -130,14 +126,16 @@ protected:
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
private:
void setAsMdiWindow( int mainWindowID );
friend class RimProject;
void setAsMdiWindow( int mainWindowID );
virtual void assignIdIfNecessary() = 0;
protected:
caf::PdmField<bool> m_showWindow;
private:
caf::PdmChildField<RimMdiWindowController*> m_windowController;
caf::PdmField<int> m_viewId;
// Obsoleted field
caf::PdmField<std::vector<int>> obsoleteField_windowGeometry;

View File

@@ -135,8 +135,8 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
parameterSources->add( &m_userDefinedUcs );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Title, Legend and Axis" );
RimWellLogPlot::uiOrderingForPlotLayout( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
RimWellLogPlot::uiOrderingForLegendSettings( uiConfigName, *legendAndAxisGroup );
uiOrderingForDepthAxis( uiConfigName, *legendAndAxisGroup );
uiOrdering.skipRemainingFields( true );
}

View File

@@ -47,7 +47,7 @@ RimWellLogCurve::RimWellLogCurve()
CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png", "", "" );
m_qwtPlotCurve->setXAxis( QwtPlot::xTop );
m_qwtPlotCurve->setErrorBarsXAxis( QwtPlot::xTop );
m_qwtCurveErrorBars->setXAxis( QwtPlot::xTop );
m_qwtPlotCurve->setYAxis( QwtPlot::yLeft );
m_curveData = new RigWellLogCurveData;
@@ -187,7 +187,7 @@ void RimWellLogCurve::updateLegendsInPlot()
firstAncestorOrThisOfType( wellLogTrack );
if ( wellLogTrack )
{
wellLogTrack->updateAllLegendItems();
wellLogTrack->updateLegend();
}
}

View File

@@ -21,10 +21,12 @@
#include "RimCase.h"
#include "RimDataSourceSteppingTools.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"
#include "RimGeoMechCase.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlot.h"
@@ -285,6 +287,7 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
}
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
RimWellFlowRateCurve* flowRateCurve = dynamic_cast<RimWellFlowRateCurve*>( curve );
if ( extractionCurve )
{
RimWellLogWbsCurve* wbsCurve = dynamic_cast<RimWellLogWbsCurve*>( extractionCurve );
@@ -322,6 +325,13 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
m_uniqueWellPaths.insert( fileCurve->wellPath() );
m_uniqueWellNames.insert( fileCurve->wellName() );
}
else if ( flowRateCurve )
{
m_uniqueTrajectoryTypes.insert( RimWellLogExtractionCurve::SIMULATION_WELL );
m_uniqueWellNames.insert( flowRateCurve->wellName() );
m_uniqueCases.insert( flowRateCurve->rimCase() );
m_uniqueTimeSteps.insert( flowRateCurve->timeStep() );
}
}
for ( RimWellLogTrack* track : tracks )
{

View File

@@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionC
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
: RimNameConfig()
: RimNameConfig( "Log Extraction" )
{
CAF_PDM_InitObject( "Well Log Extraction Curve Name Generator", "", "", "" );
@@ -38,8 +38,6 @@ RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
CAF_PDM_InitField( &m_addWellName, "AddWellName", true, "Add Well Name", "", "", "" );
CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" );
CAF_PDM_InitField( &m_addDate, "AddDate", true, "Add Date", "", "", "" );
m_customName = "Log Extraction";
}
//--------------------------------------------------------------------------------------------------
@@ -85,7 +83,7 @@ bool RimWellLogExtractionCurveNameConfig::addDate() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags( bool enable )
void RimWellLogExtractionCurveNameConfig::doEnableAllAutoNameTags( bool enable )
{
m_addCaseName = enable;
m_addProperty = enable;

View File

@@ -37,11 +37,12 @@ public:
bool addTimeStep() const;
bool addDate() const;
void enableAllAutoNameTags( bool enable ) override;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void doEnableAllAutoNameTags( bool enable ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addProperty;

View File

@@ -29,8 +29,12 @@ CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConf
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig()
: RimNameConfig()
: RimNameConfig( "Las Curve" )
{
CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" );
m_customName = "Las Curve";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurveNameConfig::doEnableAllAutoNameTags( bool enable ) {}

View File

@@ -30,4 +30,7 @@ class RimWellLogFileCurveNameConfig : public RimNameConfig
public:
RimWellLogFileCurveNameConfig();
private:
void doEnableAllAutoNameTags( bool enable ) override;
};

Some files were not shown because too many files have changed in this diff Show More