Add some features to well log plot, track and curve creation.

* Needed for creating the well bore stability plots
* Add ability to set plot and track titles
* Make updating and refreshing plots optional when adding curves/tracks so it can be done at the end instead.
* Optionally set custom titles to the plots and tracks.
This commit is contained in:
Gaute Lindkvist 2018-06-29 11:36:50 +02:00
parent e1fa79c066
commit e39a34cd0d
6 changed files with 102 additions and 28 deletions

View File

@ -406,6 +406,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
if (!m_mainPlotWindow) if (!m_mainPlotWindow)
{ {
createMainPlotWindow(); createMainPlotWindow();
m_mainPlotWindow->show();
} }
else else
{ {
@ -1346,6 +1347,18 @@ int RiaApplication::launchUnitTestsWithConsole()
return launchUnitTests(); return launchUnitTests();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotMainWindow* RiaApplication::getOrCreateMainPlotWindow()
{
if (!m_mainPlotWindow)
{
createMainPlotWindow();
}
return m_mainPlotWindow;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1358,7 +1371,6 @@ void RiaApplication::createMainPlotWindow()
m_mainPlotWindow->setWindowTitle("Plots - ResInsight"); m_mainPlotWindow->setWindowTitle("Plots - ResInsight");
m_mainPlotWindow->setDefaultWindowSize(); m_mainPlotWindow->setDefaultWindowSize();
m_mainPlotWindow->loadWinGeoAndDockToolBarLayout(); m_mainPlotWindow->loadWinGeoAndDockToolBarLayout();
m_mainPlotWindow->showWindow();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -180,6 +180,7 @@ public:
int launchUnitTests(); int launchUnitTests();
int launchUnitTestsWithConsole(); int launchUnitTestsWithConsole();
RiuPlotMainWindow* getOrCreateMainPlotWindow();
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow(); RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
RiuPlotMainWindow* mainPlotWindow(); RiuPlotMainWindow* mainPlotWindow();
RiuMainWindowBase* mainWindowByID(int mainWindowID); RiuMainWindowBase* mainWindowByID(int mainWindowID);

View File

@ -206,7 +206,13 @@ RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve(RimWellLogTrack* plotTrack, Rim3dView* view, RimWellPath* wellPath, const RimSimWellInView* simWell, int branchIndex, bool useBranchDetection) RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve(RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve(); RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
@ -238,20 +244,23 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve(RimWellLogTrack*
plotTrack->updateConnectedEditors(); plotTrack->updateConnectedEditors();
// Make sure the summary plot window is created and visible
RiuPlotMainWindowTools::showPlotMainWindow();
RiaApplication::instance()->project()->updateConnectedEditors(); RiaApplication::instance()->project()->updateConnectedEditors();
RiaApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(curve); RiuPlotMainWindowTools::selectAsCurrentItem(curve);
if (showPlotWindow)
{
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve; return curve;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell) RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell, bool showPlotWindow)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
@ -287,19 +296,23 @@ RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, con
plotTrack->setFormationTrajectoryType(RimWellLogTrack::SIMULATION_WELL); plotTrack->setFormationTrajectoryType(RimWellLogTrack::SIMULATION_WELL);
plotTrack->updateConnectedEditors(); plotTrack->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiaApplication::instance()->project()->updateConnectedEditors(); RiaApplication::instance()->project()->updateConnectedEditors();
RiaApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(curve); RiuPlotMainWindowTools::selectAsCurrentItem(curve);
if (showPlotWindow)
{
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve; return curve;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack) RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack, bool showPlotWindow)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
@ -312,8 +325,15 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack)
plotTrack->updateConnectedEditors(); plotTrack->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow(); RiaApplication::instance()->project()->updateConnectedEditors();
RiaApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(curve); RiuPlotMainWindowTools::selectAsCurrentItem(curve);
if (showPlotWindow)
{
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve; return curve;
} }

View File

@ -50,7 +50,8 @@ public:
static RimWellPath* findWellPathWithLogFileFromSelection(); static RimWellPath* findWellPathWithLogFileFromSelection();
static RimWellLogExtractionCurve* addExtractionCurve(RimWellLogTrack* plotTrack, Rim3dView* view, RimWellPath* wellPath, static RimWellLogExtractionCurve* addExtractionCurve(RimWellLogTrack* plotTrack, Rim3dView* view, RimWellPath* wellPath,
const RimSimWellInView* simWell, int branchIndex, const RimSimWellInView* simWell, int branchIndex,
bool useBranchDetection); bool useBranchDetection,
static RimWellLogRftCurve* addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell); bool showPlotWindow = true);
static RimWellLogFileCurve* addFileCurve(RimWellLogTrack* plotTrack); static RimWellLogRftCurve* addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell, bool showPlotWindow = true);
static RimWellLogFileCurve* addFileCurve(RimWellLogTrack* plotTrack, bool showPlotWindow = true);
}; };

View File

@ -29,23 +29,37 @@
#include "cvfAssert.h" #include "cvfAssert.h"
#include <QString>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot() RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot(bool showAfterCreation, const QString& plotDescription)
{ {
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection(); RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT(wellLogPlotColl); CVF_ASSERT(wellLogPlotColl);
RimWellLogPlot* plot = new RimWellLogPlot(); RimWellLogPlot* plot = new RimWellLogPlot();
plot->setAsPlotMdiWindow(); plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back(plot); wellLogPlotColl->wellLogPlots().push_back(plot);
// Make sure the summary plot window is created and visible // Make sure the summary plot window is created
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); RiaApplication::instance()->getOrCreateMainPlotWindow();
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size())); if (!plotDescription.isEmpty())
{
plot->setDescription(plotDescription);
}
else
{
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size()));
}
if (showAfterCreation)
{
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
return plot; return plot;
} }
@ -53,21 +67,45 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack() RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(bool updateAfter, const QString& trackDescription, RimWellLogPlot* existingPlot)
{ {
RimWellLogPlot* plot = createWellLogPlot(); RimWellLogPlot* plot = existingPlot;
if (plot == nullptr)
{
plot = createWellLogPlot();
}
RimWellLogTrack* plotTrack = new RimWellLogTrack(); RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addTrack(plotTrack); plot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount())); if (!trackDescription.isEmpty())
{
plotTrack->setDescription(trackDescription);
}
else
{
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));
}
plot->loadDataAndUpdate(); if (updateAfter)
plot->updateConnectedEditors(); {
RiaApplication::instance()->project()->updateConnectedEditors(); updateAfterCreation(plot);
}
return plotTrack; return plotTrack;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeatureImpl::updateAfterCreation(RimWellLogPlot* plot)
{
CVF_ASSERT(plot);
plot->loadDataAndUpdate();
plot->updateDepthZoom();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -19,6 +19,8 @@
#pragma once #pragma once
#include <QString>
class RimWellLogPlotCollection; class RimWellLogPlotCollection;
class RimWellLogPlot; class RimWellLogPlot;
class RimWellLogTrack; class RimWellLogTrack;
@ -29,9 +31,9 @@ class RimWellLogTrack;
class RicNewWellLogPlotFeatureImpl class RicNewWellLogPlotFeatureImpl
{ {
public: public:
static RimWellLogPlot* createWellLogPlot(); static RimWellLogPlot* createWellLogPlot(bool showAfterCreation = true, const QString& plotDescription = QString(""));
static RimWellLogTrack* createWellLogPlotTrack(); static RimWellLogTrack* createWellLogPlotTrack(bool updateAfterCreation = true, const QString& trackDescription = QString(""), RimWellLogPlot* existingPlot = nullptr);
static void updateAfterCreation(RimWellLogPlot* plot);
private: private:
static RimWellLogPlotCollection* wellLogPlotCollection(); static RimWellLogPlotCollection* wellLogPlotCollection();
}; };