(#468) Added context menu item in 3D view for plotting of logs from LAS files

This commit is contained in:
Pål Hagen 2015-09-21 14:02:33 +02:00
parent e7866cbdfd
commit 8667b6baa0
6 changed files with 95 additions and 17 deletions

View File

@ -20,9 +20,13 @@
#include "RicNewWellLogFileCurveFeature.h" #include "RicNewWellLogFileCurveFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h" #include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimWellLogFileCurve.h" #include "RimWellLogFileCurve.h"
#include "RimWellLogPlotTrack.h" #include "RimWellLogPlotTrack.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
@ -40,7 +44,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogFileCurveFeature, "RicNewWellLogFileCurveFeatur
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicNewWellLogFileCurveFeature::isCommandEnabled() bool RicNewWellLogFileCurveFeature::isCommandEnabled()
{ {
return selectedWellLogPlotTrack() != NULL; return selectedWellLogPlotTrack() != NULL || selectedWellLogPlotTrackWithLogFile() != NULL;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -53,6 +57,17 @@ void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked)
{ {
addCurve(wellLogPlotTrack); addCurve(wellLogPlotTrack);
} }
else
{
RimWellPath* wellPath = selectedWellLogPlotTrackWithLogFile();
if (wellPath)
{
RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogFileCurve* plotCurve = addCurve(wellLogPlotTrack);
plotCurve->setWellPath(wellPath);
plotCurve->updateConnectedEditors();
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -76,13 +91,33 @@ RimWellLogPlotTrack* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrack()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack* plotTrack) RimWellPath* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrackWithLogFile()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)
{
RimWellPath* wellPath = selection[0];
if (wellPath->m_wellLogFile())
{
return wellPath;
}
}
return NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack* plotTrack)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
size_t curveIndex = plotTrack->curveCount(); size_t curveIndex = plotTrack->curveCount();
RimWellLogPlotCurve* curve = new RimWellLogFileCurve(); RimWellLogFileCurve* curve = new RimWellLogFileCurve();
plotTrack->addCurve(curve); plotTrack->addCurve(curve);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
@ -91,4 +126,6 @@ void RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack* plotTrack)
plotTrack->updateConnectedEditors(); plotTrack->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve); RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
return curve;
} }

View File

@ -22,6 +22,8 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
class RimWellLogPlotTrack; class RimWellLogPlotTrack;
class RimWellLogFileCurve;
class RimWellPath;
//================================================================================================== //==================================================================================================
/// ///
@ -31,7 +33,7 @@ class RicNewWellLogFileCurveFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public: public:
static void addCurve(RimWellLogPlotTrack* plotTrack); static RimWellLogFileCurve* addCurve(RimWellLogPlotTrack* plotTrack);
protected: protected:
@ -42,4 +44,5 @@ protected:
private: private:
RimWellLogPlotTrack* selectedWellLogPlotTrack(); RimWellLogPlotTrack* selectedWellLogPlotTrack();
RimWellPath* selectedWellLogPlotTrackWithLogFile();
}; };

View File

@ -20,11 +20,14 @@
#include "RicNewWellLogPlotFeature.h" #include "RicNewWellLogPlotFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h" #include "RicNewWellLogPlotFeatureImpl.h"
#include "RicNewWellLogFileCurveFeature.h"
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h" #include "RimWellLogPlotTrack.h"
#include "RicNewWellLogCurveExtractionFeature.h" #include "RimWellLogPlotCurve.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include <QAction> #include <QAction>
@ -47,16 +50,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked) void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{ {
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(); RimWellLogPlotTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack();
plot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));
plot->loadDataAndUpdate();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack); RicNewWellLogCurveExtractionFeature::addCurve(plotTrack);
} }

View File

@ -23,6 +23,7 @@
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RiaApplication.h" #include "RiaApplication.h"
@ -78,3 +79,21 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
return plot; return plot;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack()
{
RimWellLogPlot* plot = createWellLogPlot();
RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack();
plot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));
plot->loadDataAndUpdate();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
return plotTrack;
}

View File

@ -22,6 +22,7 @@
class RimMainPlotCollection; class RimMainPlotCollection;
class RimWellLogPlotCollection; class RimWellLogPlotCollection;
class RimWellLogPlot; class RimWellLogPlot;
class RimWellLogPlotTrack;
//================================================================================================== //==================================================================================================
/// ///
@ -33,4 +34,5 @@ public:
static RimMainPlotCollection* mainPlotCollection(); static RimMainPlotCollection* mainPlotCollection();
static RimWellLogPlotCollection* wellLogPlotCollection(); static RimWellLogPlotCollection* wellLogPlotCollection();
static RimWellLogPlot* createWellLogPlot(); static RimWellLogPlot* createWellLogPlot();
static RimWellLogPlotTrack* createWellLogPlotTrack();
}; };

View File

@ -24,6 +24,7 @@
#include "RicEclipsePropertyFilterNewExec.h" #include "RicEclipsePropertyFilterNewExec.h"
#include "RicGeoMechPropertyFilterNewExec.h" #include "RicGeoMechPropertyFilterNewExec.h"
#include "RicRangeFilterNewExec.h" #include "RicRangeFilterNewExec.h"
#include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h"
#include "RigCaseData.h" #include "RigCaseData.h"
#include "RigFemPartCollection.h" #include "RigFemPartCollection.h"
@ -49,6 +50,7 @@
#include "RimView.h" #include "RimView.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimWellPathCollection.h" #include "RimWellPathCollection.h"
#include "RimWellLogFile.h"
#include "RiuFemResultTextBuilder.h" #include "RiuFemResultTextBuilder.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
@ -63,6 +65,7 @@
#include "cafCmdExecCommandManager.h" #include "cafCmdExecCommandManager.h"
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "cafCmdFeatureManager.h" #include "cafCmdFeatureManager.h"
#include "cafSelectionManager.h"
#include "cvfDrawableGeo.h" #include "cvfDrawableGeo.h"
#include "cvfHitItemCollection.h" #include "cvfHitItemCollection.h"
@ -200,6 +203,28 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
} }
} }
if (firstHitPart && firstHitPart->sourceInfo())
{
const RivWellPathSourceInfo* wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstHitPart->sourceInfo());
if (wellPathSourceInfo)
{
RimWellPath* wellPath = wellPathSourceInfo->wellPath();
if (wellPath)
{
// TODO: Handle selection through mouse events outside this method, or after ray picking above
caf::SelectionManager::instance()->setSelectedItem(wellPath);
RiaApplication::instance()->project()->updateConnectedEditors();
RicNewWellLogFileCurveFeature* newWellLogFileCurveFeature = dynamic_cast<RicNewWellLogFileCurveFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogFileCurveFeature"));
CVF_ASSERT(newWellLogFileCurveFeature);
menu.addAction(newWellLogFileCurveFeature->action());
}
}
}
if (firstHitPart)
// View Link commands // View Link commands
{ {
QStringList commandIds; QStringList commandIds;
@ -604,5 +629,3 @@ void RiuViewerCommands::ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size
geomView->geoMechCase()->geoMechData()->femParts()->part(gridIdx)->structGrid()->ijkFromCellIndex(cellIndex, i, j, k); geomView->geoMechCase()->geoMechData()->femParts()->part(gridIdx)->structGrid()->ijkFromCellIndex(cellIndex, i, j, k);
} }
} }