WIP resolved conflicts

This commit is contained in:
Magne Sjaastad
2015-09-18 13:02:33 +02:00
parent 6be5be4746
commit 842363eebd
9 changed files with 145 additions and 81 deletions

View File

@@ -93,7 +93,6 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIdx);
curve->setColor(curveColor);
curve->setDescription(wellLog->name());
curve->setWellPath(wellPath);
curve->setWellLogChannelName(wellLog->name());

View File

@@ -88,8 +88,7 @@ void RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrac
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
curve->setColor(curveColor);
curve->setDescription(QString("Curve %1").arg(plotTrack->curveCount()));
plotTrack->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
}

View File

@@ -88,8 +88,7 @@ void RicNewWellLogCurveLasFeature::addCurve(RimWellLogPlotTrack* plotTrack)
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
curve->setColor(curveColor);
curve->setDescription(QString("Curve %1").arg(plotTrack->curveCount()));
plotTrack->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
}

View File

@@ -112,9 +112,9 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::updatePlotData()
{
RimWellLogPlotCurve::updatePlotData();
RimWellLogPlotCurve::updatePlotConfiguration();
if (m_showCurve)
if (isCurveVisibile())
{
// Make sure we have set correct case data into the result definitions.
@@ -217,10 +217,9 @@ void RimWellLogExtractionCurve::updatePlotData()
}
}
updateCurveTitle();
updatePlotTitle();
m_plot->replot();
}
}
//--------------------------------------------------------------------------------------------------
@@ -277,16 +276,17 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
RimWellLogPlotCurve::defineUiOrdering(uiConfigName, uiOrdering);
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
uiOrdering.add(&m_userName);
uiOrdering.add(&m_wellPath);
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
group1->add(&m_case);
if (eclipseCase)
{
group1->add(&(m_eclipseResultDefinition->m_resultTypeUiField));
group1->add(&(m_eclipseResultDefinition->m_porosityModelUiField));
group1->add(&(m_eclipseResultDefinition->m_resultVariableUiField));
@@ -310,33 +310,6 @@ void RimWellLogExtractionCurve::initAfterRead()
m_geomResultDefinition->setGeoMechCase(geomCase);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::updateCurveTitle()
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
QString resVar;
if (eclipseCase)
{
resVar = m_eclipseResultDefinition->resultVariable();
}
if (geomCase)
{
QString resCompName = m_geomResultDefinition->resultComponentUiName();
if (resCompName.isEmpty())
resVar = m_geomResultDefinition->resultFieldUiName();
else
resVar = m_geomResultDefinition->resultFieldUiName() + "." + resCompName ;
}
m_userName = resVar;
m_plotCurve->setTitle(m_userName);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -442,3 +415,29 @@ void RimWellLogExtractionCurve::filteredIntervals(const std::vector< std::pair<s
index += intervalSize;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogExtractionCurve::createCurveName()
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
QString resVar;
if (eclipseCase)
{
resVar = m_eclipseResultDefinition->resultVariable();
}
if (geomCase)
{
QString resCompName = m_geomResultDefinition->resultComponentUiName();
if (resCompName.isEmpty())
resVar = m_geomResultDefinition->resultFieldUiName();
else
resVar = m_geomResultDefinition->resultFieldUiName() + "." + resCompName;
}
return resVar;
}

View File

@@ -42,7 +42,7 @@ public:
virtual void updatePlotData();
protected:
void updateCurveTitle();
virtual QString createCurveName();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);

View File

@@ -65,9 +65,9 @@ RimWellLogFileCurve::~RimWellLogFileCurve()
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::updatePlotData()
{
RimWellLogPlotCurve::updatePlotData();
RimWellLogPlotCurve::updatePlotConfiguration();
if (m_showCurve)
if (isCurveVisibile())
{
if (m_wellPath)
{
@@ -127,6 +127,7 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
if (changedField == &m_wellPath)
{
this->updatePlotTitle();
this->updatePlotData();
if (wellLoglot)
@@ -142,11 +143,7 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
}
else if (changedField == &m_wellLogChannnelName)
{
if (oldValue.toString() == m_userName)
{
m_userName = m_wellLogChannnelName;
}
this->updatePlotTitle();
this->updatePlotData();
if (wellLoglot)
@@ -172,7 +169,8 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_userName);
RimWellLogPlotCurve::defineUiOrdering(uiConfigName, uiOrdering);
uiOrdering.add(&m_wellPath);
uiOrdering.add(&m_wellLogChannnelName);
}
@@ -237,3 +235,11 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const c
return optionList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::createCurveName()
{
return "The method or operation is not implemented.";
}

View File

@@ -41,12 +41,17 @@ public:
RimWellLogFileCurve();
virtual ~RimWellLogFileCurve();
virtual void updatePlotData();
void setWellPath(RimWellPath* wellPath);
void setWellLogChannelName(const QString& name);
// Overrides from RimWellLogPlotCurve
virtual void updatePlotData();
protected:
// Overrides from RimWellLogPlotCurve
virtual QString createCurveName();
// Pdm overrrides
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");

View File

@@ -26,7 +26,8 @@
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT(RimWellLogPlotCurve, "WellLogPlotCurve");
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogPlotCurve, "WellLogPlotCurve");
//--------------------------------------------------------------------------------------------------
///
@@ -37,7 +38,14 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
m_showCurve.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_userName, "CurveDescription", "Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_generatedCurveName, "GeneratedCurveName", "Generated Curve Name", "", "", "");
m_generatedCurveName.uiCapability()->setUiReadOnly(true);
m_generatedCurveName.xmlCapability()->setIOReadable(false);
m_generatedCurveName.xmlCapability()->setIOWritable(false);
CAF_PDM_InitField(&m_useCustomCurveName, "UseCustomCurveName", false, "Custom Curve Name", "", "", "");
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
@@ -65,24 +73,25 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
if (changedField == &m_showCurve)
{
this->updateCurveVisibility();
m_plot->replot();
}
if (m_showCurve())
if (changedField == &m_customCurveName)
{
if (changedField == &m_userName)
{
m_plotCurve->setTitle(this->m_userName());
m_plot->replot();
updatePlotTitle();
}
if (&m_curveColor == changedField)
{
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
}
if (changedField == &m_useCustomCurveName)
{
updatePlotTitle();
}
m_plot->replot();
}
}
}
//--------------------------------------------------------------------------------------------------
///
@@ -110,11 +119,10 @@ void RimWellLogPlotCurve::updateCurveVisibility()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotData()
void RimWellLogPlotCurve::updatePlotConfiguration()
{
this->updateCurveVisibility();
m_plotCurve->setTitle(this->m_userName());
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
// Todo: Rest of the curve setup controlled from this class
}
@@ -137,7 +145,14 @@ void RimWellLogPlotCurve::setPlot(RiuWellLogTrackPlot* plot)
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
{
return &m_userName;
if (m_useCustomCurveName)
{
return &m_customCurveName;
}
else
{
return &m_generatedCurveName;
}
}
//--------------------------------------------------------------------------------------------------
@@ -202,3 +217,38 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
{
return m_plotCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotTitle()
{
if (m_useCustomCurveName)
{
m_plotCurve->setTitle(m_customCurveName);
}
else
{
m_generatedCurveName = this->createCurveName();
m_plotCurve->setTitle(m_generatedCurveName);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_customCurveName);
uiOrdering.add(&m_generatedCurveName);
uiOrdering.add(&m_useCustomCurveName);
uiOrdering.add(&m_curveColor);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotCurve::isCurveVisibile()
{
return m_showCurve;
}

View File

@@ -19,9 +19,9 @@
#pragma once
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmObject.h"
#include <vector>
@@ -41,7 +41,6 @@ public:
RimWellLogPlotCurve();
virtual ~RimWellLogPlotCurve();
void setDescription(QString description) {m_userName = description;}
void setColor(const cvf::Color3f& color);
bool depthRange(double* minimumDepth, double* maximumDepth) const;
@@ -50,25 +49,33 @@ public:
void setPlot(RiuWellLogTrackPlot* plot);
void detachCurve();
bool isCurveVisibile();
QwtPlotCurve* plotCurve() const;
virtual void updatePlotData();
virtual void updatePlotData() = 0;
protected:
virtual QString createCurveName() = 0;
void updatePlotConfiguration();
void updateCurveVisibility();
void updatePlotTitle();
// Overridden PDM methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual caf::PdmFieldHandle* objectToggleField();
virtual caf::PdmFieldHandle* userDescriptionField();
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_userName;
caf::PdmField<cvf::Color3f> m_curveColor;
// caf::PdmField<Linestyle> m_lineStyle;
// caf::PdmField<int> m_lineWidth;
RiuWellLogTrackPlot* m_plot;
RiuWellLogPlotCurve* m_plotCurve;
private:
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_customCurveName;
caf::PdmField<QString> m_generatedCurveName;
caf::PdmField<bool> m_useCustomCurveName;
caf::PdmField<cvf::Color3f> m_curveColor;
};