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

View File

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

View File

@ -51,7 +51,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{
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()));
wellLogPlot->updateConnectedEditors();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack);
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
}
}

View File

@ -41,6 +41,10 @@
#include "RimWellLogPlotTrack.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimGeoMechView.h"
#include "RimGeoMechCellColors.h"
#include "RiuWellLogPlotCurve.h"
#include "RiuWellLogTrackPlot.h"
@ -107,6 +111,33 @@ void RimWellLogExtractionCurve::setWellPath(RimWellPath* 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 RimGeoMechResultDefinition;
class RimWellPath;
class RimView;
//==================================================================================================
///
@ -43,6 +44,7 @@ public:
virtual void updatePlotData();
void setWellPath(RimWellPath* wellPath);
void setPropertiesFromView(RimView* view);
protected:
virtual QString createCurveName();