(#528) Using case and current result from active view when adding new curve

This commit is contained in:
Pål Hagen 2015-09-25 14:35:30 +02:00
parent 4e3f51909b
commit d8acb9d1bc
6 changed files with 45 additions and 8 deletions

View File

@ -28,6 +28,7 @@
#include "RimWellPathCollection.h" #include "RimWellPathCollection.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiaApplication.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
@ -54,7 +55,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
RimWellLogPlotTrack* wellLogPlotTrack = selectedWellLogPlotTrack(); RimWellLogPlotTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
if (wellLogPlotTrack) if (wellLogPlotTrack)
{ {
addCurve(wellLogPlotTrack); addCurve(wellLogPlotTrack, NULL, NULL);
} }
else else
{ {
@ -62,8 +63,9 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
if (wellPath) if (wellPath)
{ {
RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack); RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
plotCurve->setWellPath(wellPath);
plotCurve->updatePlotData();
plotCurve->updateConnectedEditors(); plotCurve->updateConnectedEditors();
} }
} }
@ -100,7 +102,7 @@ RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrack) RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrack, RimView* view, RimWellPath* wellPath)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
@ -111,9 +113,10 @@ RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWell
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
curve->setColor(curveColor); curve->setColor(curveColor);
curve->setWellPath(wellPath);
curve->setPropertiesFromView(view);
plotTrack->updateConnectedEditors(); plotTrack->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve); RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
return curve; return curve;

View File

@ -24,6 +24,7 @@
class RimWellLogExtractionCurve; class RimWellLogExtractionCurve;
class RimWellLogPlotTrack; class RimWellLogPlotTrack;
class RimWellPath; class RimWellPath;
class RimView;
//================================================================================================== //==================================================================================================
/// ///
@ -33,7 +34,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public: public:
static RimWellLogExtractionCurve* addCurve(RimWellLogPlotTrack* plotTrack); static RimWellLogExtractionCurve* addCurve(RimWellLogPlotTrack* plotTrack, RimView* view, RimWellPath* wellPath);
protected: protected:

View File

@ -51,7 +51,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked) void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{ {
RimWellLogPlotTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogPlotTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack); RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -54,7 +54,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount())); plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
wellLogPlot->updateConnectedEditors(); wellLogPlot->updateConnectedEditors();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack); RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
} }
} }

View File

@ -41,6 +41,10 @@
#include "RimWellLogPlotTrack.h" #include "RimWellLogPlotTrack.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimWellPathCollection.h" #include "RimWellPathCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimGeoMechView.h"
#include "RimGeoMechCellColors.h"
#include "RiuWellLogPlotCurve.h" #include "RiuWellLogPlotCurve.h"
#include "RiuWellLogTrackPlot.h" #include "RiuWellLogTrackPlot.h"
@ -107,6 +111,33 @@ void RimWellLogExtractionCurve::setWellPath(RimWellPath* wellPath)
m_wellPath = wellPath; m_wellPath = wellPath;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
{
m_case = view ? view->ownerCase() : NULL;
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
m_geomResultDefinition->setGeoMechCase(geomCase);
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
if (eclipseView)
{
m_eclipseResultDefinition->setResultType(eclipseView->cellResult()->resultType());
m_eclipseResultDefinition->setResultVariable(eclipseView->cellResult()->resultVariable());
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
if (geoMechView)
{
m_geomResultDefinition->setResultAddress(geoMechView->cellResult()->resultAddress());
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -28,6 +28,7 @@ class RimCase;
class RimEclipseResultDefinition; class RimEclipseResultDefinition;
class RimGeoMechResultDefinition; class RimGeoMechResultDefinition;
class RimWellPath; class RimWellPath;
class RimView;
//================================================================================================== //==================================================================================================
/// ///
@ -43,6 +44,7 @@ public:
virtual void updatePlotData(); virtual void updatePlotData();
void setWellPath(RimWellPath* wellPath); void setWellPath(RimWellPath* wellPath);
void setPropertiesFromView(RimView* view);
protected: protected:
virtual QString createCurveName(); virtual QString createCurveName();