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

@@ -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();
};