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)
{
createMainPlotWindow();
m_mainPlotWindow->show();
}
else
{
@ -1346,6 +1347,18 @@ int RiaApplication::launchUnitTestsWithConsole()
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->setDefaultWindowSize();
m_mainPlotWindow->loadWinGeoAndDockToolBarLayout();
m_mainPlotWindow->showWindow();
}
//--------------------------------------------------------------------------------------------------

View File

@ -180,6 +180,7 @@ public:
int launchUnitTests();
int launchUnitTestsWithConsole();
RiuPlotMainWindow* getOrCreateMainPlotWindow();
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
RiuPlotMainWindow* mainPlotWindow();
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);
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
@ -238,20 +244,23 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve(RimWellLogTrack*
plotTrack->updateConnectedEditors();
// Make sure the summary plot window is created and visible
RiuPlotMainWindowTools::showPlotMainWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
RiaApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
if (showPlotWindow)
{
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell)
RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell, bool showPlotWindow)
{
CVF_ASSERT(plotTrack);
@ -287,19 +296,23 @@ RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, con
plotTrack->setFormationTrajectoryType(RimWellLogTrack::SIMULATION_WELL);
plotTrack->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
RiaApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
if (showPlotWindow)
{
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack)
RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack, bool showPlotWindow)
{
CVF_ASSERT(plotTrack);
@ -312,8 +325,15 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack)
plotTrack->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
RiaApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
if (showPlotWindow)
{
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve;
}

View File

@ -50,7 +50,8 @@ public:
static RimWellPath* findWellPathWithLogFileFromSelection();
static RimWellLogExtractionCurve* addExtractionCurve(RimWellLogTrack* plotTrack, Rim3dView* view, RimWellPath* wellPath,
const RimSimWellInView* simWell, int branchIndex,
bool useBranchDetection);
static RimWellLogRftCurve* addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell);
static RimWellLogFileCurve* addFileCurve(RimWellLogTrack* plotTrack);
bool useBranchDetection,
bool showPlotWindow = true);
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 <QString>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot(bool showAfterCreation, const QString& plotDescription)
{
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT(wellLogPlotColl);
RimWellLogPlot* plot = new RimWellLogPlot();
plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back(plot);
// Make sure the summary plot window is created and visible
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
// Make sure the summary plot window is created
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;
}
@ -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();
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();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
if (updateAfter)
{
updateAfterCreation(plot);
}
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
#include <QString>
class RimWellLogPlotCollection;
class RimWellLogPlot;
class RimWellLogTrack;
@ -29,9 +31,9 @@ class RimWellLogTrack;
class RicNewWellLogPlotFeatureImpl
{
public:
static RimWellLogPlot* createWellLogPlot();
static RimWellLogTrack* createWellLogPlotTrack();
static RimWellLogPlot* createWellLogPlot(bool showAfterCreation = true, const QString& plotDescription = QString(""));
static RimWellLogTrack* createWellLogPlotTrack(bool updateAfterCreation = true, const QString& trackDescription = QString(""), RimWellLogPlot* existingPlot = nullptr);
static void updateAfterCreation(RimWellLogPlot* plot);
private:
static RimWellLogPlotCollection* wellLogPlotCollection();
};