#1842 RFT Plot. Show plot when new RFT plot command is triggered

This commit is contained in:
Bjørn Erik Jensen
2017-10-02 09:40:33 +02:00
parent 19e5e61cb7
commit 2add09ea33
9 changed files with 136 additions and 57 deletions

View File

@@ -30,6 +30,7 @@
#include "RimView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellRftPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimRftPlotCollection.h"
@@ -74,26 +75,39 @@ void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
std::vector<caf::PdmUiItem*> selectedItems;
caf::SelectionManager::instance()->selectedItems(selectedItems);
// Todo: support other classes as well
RimWellPath* simWellPath = dynamic_cast<RimWellPath*>(selectedItems.front());
QString wellName = "(unknown well name)";
RimWellPath* wellPath = nullptr;
RimEclipseWell* eclipseWell = nullptr;
if ((wellPath = dynamic_cast<RimWellPath*>(selectedItems.front())) != nullptr)
{
wellName = wellPath->name();
}
else if ((eclipseWell = dynamic_cast<RimEclipseWell*>(selectedItems.front())) != nullptr)
{
wellName = eclipseWell->name();
}
QString plotName = QString("RFT: %1").arg(simWellPath != nullptr ? simWellPath->name() : QString("(Unknown)"));
QString plotName = QString("RFT: %1").arg(wellName);
auto plot = new RimWellRftPlot();
plot->setCurrentWellName(simWellPath->name());
rftPlotColl->addPlot(plot);
auto rftPlot = new RimWellRftPlot();
rftPlot->setCurrentWellName(wellName);
plot->setDescription(plotName);
plot->loadDataAndUpdate();
auto plotTrack = new RimWellLogTrack();
rftPlot->wellLogPlot()->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(rftPlot->wellLogPlot()->trackCount()));
rftPlotColl->updateConnectedEditors();
rftPlotColl->addPlot(rftPlot);
rftPlot->setDescription(plotName);
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->selectAsCurrentItem(plot);
mainPlotWindow->setExpanded(plot, true);
mainPlotWindow->selectAsCurrentItem(rftPlot);
mainPlotWindow->setExpanded(rftPlot, true);
}
rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();
}
}