Skip to content

Commit

Permalink
(#500) Improved curve data property panel
Browse files Browse the repository at this point in the history
Show curve data group first
Hide auto name properties when custom name is defined
  • Loading branch information
magnesj committed Sep 22, 2015
1 parent 81b973a commit b481699
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 106 deletions.
70 changes: 37 additions & 33 deletions ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
CAF_PDM_InitField(&m_addPropertyToCurveName, "AddPropertyToCurveName", true, "Property", "", "", "");
CAF_PDM_InitField(&m_addWellNameToCurveName, "AddWellNameToCurveName", true, "WellName", "", "", "");
CAF_PDM_InitField(&m_addTimestepToCurveName, "AddTimestepToCurveName", true, "Timestep", "", "", "");

updateOptionSensitivity();
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -114,13 +116,11 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
{
this->updatePlotData();
}

if (changedField == &m_wellPath)
else if (changedField == &m_wellPath)
{
this->updatePlotData();
}

if (changedField == &m_timeStep)
else if (changedField == &m_timeStep)
{
this->updatePlotData();
}
Expand All @@ -130,6 +130,8 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
changedField == &m_addWellNameToCurveName ||
changedField == &m_addTimestepToCurveName)
{
this->uiCapability()->updateConnectedEditors();
updateCurveName();
updatePlotTitle();
}
}
Expand Down Expand Up @@ -220,7 +222,7 @@ void RimWellLogExtractionCurve::updatePlotData()
updateTrackAndPlotFromCurveData();
}

m_plot->replot();
if (m_plot) m_plot->replot();
}
}

Expand Down Expand Up @@ -290,56 +292,58 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Curve Display Name");
caf::PdmUiGroup* generatedGroup = group->addNewGroup("Generated Display Name");
generatedGroup->add(&m_generatedCurveName);
caf::PdmUiGroup* generatedNameConfig = generatedGroup->addNewGroup("Include in Display Name");
generatedNameConfig->add(&m_addCaseNameToCurveName);
generatedNameConfig->add(&m_addPropertyToCurveName);
generatedNameConfig->add(&m_addWellNameToCurveName);
generatedNameConfig->add(&m_addTimestepToCurveName);

group->add(&m_useCustomCurveName);
group->add(&m_customCurveName);

uiOrdering.add(&m_curveColor);
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_wellPath);

RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());

uiOrdering.add(&m_wellPath);
curveDataGroup->add(&m_wellPath);

caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
group1->add(&m_case);
curveDataGroup->add(&m_case);
if (eclipseCase)
{
group1->add(&(m_eclipseResultDefinition->m_resultTypeUiField));
group1->add(&(m_eclipseResultDefinition->m_porosityModelUiField));
group1->add(&(m_eclipseResultDefinition->m_resultVariableUiField));
curveDataGroup->add(&(m_eclipseResultDefinition->m_resultTypeUiField));
curveDataGroup->add(&(m_eclipseResultDefinition->m_porosityModelUiField));
curveDataGroup->add(&(m_eclipseResultDefinition->m_resultVariableUiField));

if (m_eclipseResultDefinition->hasDynamicResult())
{
m_timeStep.uiCapability()->setUiHidden(false);
}
else
{
m_timeStep.uiCapability()->setUiHidden(true);
curveDataGroup->add(&m_timeStep);
}
}
if (geomCase)
else if (geomCase)
{
group1->add(&(m_geomResultDefinition->m_resultPositionTypeUiField));
group1->add(&(m_geomResultDefinition->m_resultVariableUiField));
curveDataGroup->add(&(m_geomResultDefinition->m_resultPositionTypeUiField));
curveDataGroup->add(&(m_geomResultDefinition->m_resultVariableUiField));

curveDataGroup->add(&m_timeStep);
}

m_timeStep.uiCapability()->setUiHidden(false);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
appearanceGroup->add(&m_curveName);
appearanceGroup->add(&m_autoName);
if (m_autoName)
{
caf::PdmUiGroup* autoGroup = appearanceGroup->addNewGroup("Auto Name Properties");
autoGroup->add(&m_addCaseNameToCurveName);
autoGroup->add(&m_addPropertyToCurveName);
autoGroup->add(&m_addWellNameToCurveName);
autoGroup->add(&m_addTimestepToCurveName);
}

appearanceGroup->add(&m_curveColor);

uiOrdering.setForgetRemainingFields(true);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::initAfterRead()
{
RimWellLogPlotCurve::initAfterRead();

RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());

Expand Down
18 changes: 12 additions & 6 deletions ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ RimWellLogFileCurve::RimWellLogFileCurve()
CAF_PDM_InitFieldNoDefault(&m_wellLogChannnelName, "CurveWellLogChannel", "Well Log Channel", "", "", "");

m_wellPath = NULL;

updateOptionSensitivity();
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -98,7 +100,7 @@ void RimWellLogFileCurve::updatePlotData()

updateTrackAndPlotFromCurveData();

m_plot->replot();
if (m_plot) m_plot->replot();
}
}

Expand Down Expand Up @@ -134,18 +136,22 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
this->updatePlotData();
}

m_plot->replot();
if (m_plot) m_plot->replot();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
RimWellLogPlotCurve::defineUiOrdering(uiConfigName, uiOrdering);

uiOrdering.add(&m_wellPath);
uiOrdering.add(&m_wellLogChannnelName);
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_wellPath);
curveDataGroup->add(&m_wellLogChannnelName);

caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
appearanceGroup->add(&m_curveName);
appearanceGroup->add(&m_autoName);
appearanceGroup->add(&m_curveColor);
}

//--------------------------------------------------------------------------------------------------
Expand Down
110 changes: 47 additions & 63 deletions ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()

CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
m_showCurve.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");

CAF_PDM_InitFieldNoDefault(&m_generatedCurveName, "GeneratedCurveName", "Autogenerated Name", "", "", "");
m_generatedCurveName.uiCapability()->setUiReadOnly(true);
m_generatedCurveName.xmlCapability()->setIOReadable(false);
m_generatedCurveName.xmlCapability()->setIOWritable(false);

CAF_PDM_InitField(&m_useCustomCurveName, "UseCustomCurveName", false, "Show Custom Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_curveName, "CurveName", "Curve Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
m_customCurveName.uiCapability()->setUiHidden(true);

CAF_PDM_InitField(&m_autoName, "AutoName", true, "Auto Name", "", "", "");

CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");

m_plotCurve = new RiuWellLogPlotCurve;
m_plotCurve->setXAxis(QwtPlot::xTop);
m_plotCurve->setYAxis(QwtPlot::yLeft);

m_plot = NULL;
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -62,7 +62,7 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
RimWellLogPlotCurve::~RimWellLogPlotCurve()
{
m_plotCurve->detach();
m_plot->replot();
if (m_plot) m_plot->replot();

delete m_plotCurve;
}
Expand All @@ -76,24 +76,28 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
{
this->updateCurveVisibility();
}

if (changedField == &m_customCurveName)
else if (changedField == &m_curveName)
{
m_customCurveName = m_curveName;
updatePlotTitle();
}

if (&m_curveColor == changedField)
else 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)
else if (changedField == &m_autoName)
{
updatePlotTitle();
if (!m_autoName)
{
m_customCurveName = createCurveName();
}

updateOptionSensitivity();
updateCurveName();
updatePlotTitle();
}

m_plot->replot();
if (m_plot) m_plot->replot();
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -109,7 +113,7 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateCurveVisibility()
{
if (m_showCurve())
if (m_showCurve() && m_plot)
{
m_plotCurve->attach(m_plot);
}
Expand All @@ -125,6 +129,7 @@ void RimWellLogPlotCurve::updateCurveVisibility()
void RimWellLogPlotCurve::updatePlotConfiguration()
{
this->updateCurveVisibility();
this->updateCurveName();
this->updatePlotTitle();

m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
Expand All @@ -149,14 +154,7 @@ void RimWellLogPlotCurve::setPlot(RiuWellLogTrackPlot* plot)
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
{
if (m_useCustomCurveName)
{
return &m_customCurveName;
}
else
{
return &m_generatedCurveName;
}
return &m_curveName;
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -197,7 +195,6 @@ bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue)
return true;
}


//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -227,29 +224,7 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotTitle()
{
m_generatedCurveName = this->createCurveName();

if (m_useCustomCurveName)
{
m_plotCurve->setTitle(m_customCurveName);
}
else
{
m_plotCurve->setTitle(m_generatedCurveName);
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Curve Display Name");
group->add(&m_generatedCurveName);
group->add(&m_useCustomCurveName);
group->add(&m_customCurveName);

uiOrdering.add(&m_curveColor);
m_plotCurve->setTitle(m_curveName);
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -265,23 +240,9 @@ bool RimWellLogPlotCurve::isCurveVisibile()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::initAfterRead()
{
// TODO:
// In RimWellLogFileCurve::createCurveName, the object being referenced is not initialized at this point
// No name is read from file
// How to fix?
m_generatedCurveName = this->createCurveName();

updateOptionSensitivity();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateOptionSensitivity()
{
m_customCurveName.uiCapability()->setUiReadOnly(!m_useCustomCurveName);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -307,3 +268,26 @@ void RimWellLogPlotCurve::updateTrackAndPlotFromCurveData()
plotTrack->updateAxisRangesAndReplot();
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateCurveName()
{
if (m_autoName)
{
m_curveName = this->createCurveName();
}
else
{
m_curveName = m_customCurveName;
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateOptionSensitivity()
{
m_curveName.uiCapability()->setUiReadOnly(m_autoName);
}
Loading

0 comments on commit b481699

Please sign in to comment.