#739 Renamed and trimmed inside RimPlotCurve

This commit is contained in:
Jacob Støren
2016-05-23 17:13:03 +02:00
parent a2ed19c687
commit c2759e47b2
13 changed files with 83 additions and 87 deletions

View File

@@ -51,7 +51,7 @@ void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
{
QString defaultDir = RiaApplication::instance()->defaultFileDialogDirectory("WELL_LOGS_DIR");
QString defaultFileName = curve->name().trimmed();
QString defaultFileName = curve->curveName().trimmed();
defaultFileName.replace(".", "_");
defaultFileName.replace(",", "_");
defaultFileName.replace(":", "_");

View File

@@ -102,7 +102,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
curve->setWellPath(wellPath);
curve->setWellLogChannelName(wellLog->name());
curve->updatePlotData();
curve->loadDataAndUpdate();
}
}

View File

@@ -68,7 +68,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
plotCurve->updatePlotData();
plotCurve->loadDataAndUpdate();
RimWellLogPlot* plot = NULL;
wellLogPlotTrack->firstAnchestorOrThisOfType(plot);

View File

@@ -172,7 +172,7 @@ void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogTrac
{
plotCurve->setWellPath(wellPath);
plotCurve->setWellLogChannelName(wellLogFileChannels[cIdx]->name());
plotCurve->updatePlotData();
plotCurve->loadDataAndUpdate();
plotCurve->updateConnectedEditors();
}
}

View File

@@ -165,7 +165,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (curve)
{
curve->updatePlotData();
curve->loadDataAndUpdate();
}
}

View File

@@ -199,7 +199,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (curve)
{
curve->updatePlotData();
curve->loadDataAndUpdate();
}
}
}

View File

@@ -76,7 +76,7 @@ RimWellLogCurve::RimWellLogCurve()
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
m_ownerQwtTrack = NULL;
m_parentQwtPlot = NULL;
}
//--------------------------------------------------------------------------------------------------
@@ -88,9 +88,9 @@ RimWellLogCurve::~RimWellLogCurve()
delete m_qwtPlotCurve;
m_qwtPlotCurve = NULL;
if (m_ownerQwtTrack)
if (m_parentQwtPlot)
{
m_ownerQwtTrack->replot();
m_parentQwtPlot->replot();
}
}
@@ -108,7 +108,7 @@ RimPlotCurve::RimPlotCurve()
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_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "");
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
@@ -149,7 +149,7 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
else if (changedField == &m_curveName)
{
m_customCurveName = m_curveName;
updatePlotTitle();
updateCurveName();
}
else if (&m_curveColor == changedField
|| &m_curveThickness == changedField
@@ -158,19 +158,18 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
{
updateCurveAppearance();
}
else if (changedField == &m_autoName)
else if (changedField == &m_isUsingAutoName)
{
if (!m_autoName)
if (!m_isUsingAutoName)
{
m_customCurveName = createCurveName();
m_customCurveName = createCurveAutoName();
}
updateOptionSensitivity();
updateCurveName();
updatePlotTitle();
}
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
@@ -186,26 +185,25 @@ caf::PdmFieldHandle* RimPlotCurve::objectToggleField()
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateCurveVisibility()
{
if (m_showCurve() && m_ownerQwtTrack)
if (m_showCurve() && m_parentQwtPlot)
{
m_qwtPlotCurve->attach(m_ownerQwtTrack);
m_qwtPlotCurve->attach(m_parentQwtPlot);
}
else
{
m_qwtPlotCurve->detach();
}
zoomAllOwnerTrackAndPlot();
zoomAllParentPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updatePlotConfiguration()
void RimPlotCurve::updateCurvePresentation()
{
this->updateCurveVisibility();
this->updateCurveName();
this->updatePlotTitle();
updateCurveAppearance();
// Todo: Rest of the curve setup controlled from this class
@@ -214,13 +212,13 @@ void RimPlotCurve::updatePlotConfiguration()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setQwtTrack(QwtPlot* plot)
void RimPlotCurve::setParentQwtPlot(QwtPlot* plot)
{
m_ownerQwtTrack = plot;
m_parentQwtPlot = plot;
if (m_showCurve)
{
m_qwtPlotCurve->attach(m_ownerQwtTrack);
m_ownerQwtTrack->replot();
m_qwtPlotCurve->attach(m_parentQwtPlot);
m_parentQwtPlot->replot();
}
}
@@ -289,19 +287,11 @@ void RimPlotCurve::detachQwtCurve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlotCurve* RimPlotCurve::plotCurve() const
QwtPlotCurve* RimPlotCurve::qwtPlotCurve() const
{
return m_qwtPlotCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updatePlotTitle()
{
m_qwtPlotCurve->setTitle(m_curveName);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -321,7 +311,7 @@ void RimPlotCurve::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::zoomAllOwnerTrackAndPlot()
void RimWellLogCurve::zoomAllParentPlot()
{
RimWellLogPlot* wellLogPlot;
firstAnchestorOrThisOfType(wellLogPlot);
@@ -345,14 +335,16 @@ void RimWellLogCurve::zoomAllOwnerTrackAndPlot()
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateCurveName()
{
if (m_autoName)
if (m_isUsingAutoName)
{
m_curveName = this->createCurveName();
m_curveName = this->createCurveAutoName();
}
else
{
m_curveName = m_customCurveName;
}
m_qwtPlotCurve->setTitle(m_curveName);
}
//--------------------------------------------------------------------------------------------------
@@ -360,7 +352,7 @@ void RimPlotCurve::updateCurveName()
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateOptionSensitivity()
{
m_curveName.uiCapability()->setUiReadOnly(m_autoName);
m_curveName.uiCapability()->setUiReadOnly(m_isUsingAutoName);
}
//--------------------------------------------------------------------------------------------------
@@ -468,3 +460,11 @@ QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions(const caf::Pdm
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::loadDataAndUpdate()
{
this->onLoadDataAndUpdate();
}

View File

@@ -133,32 +133,29 @@ public:
RimPlotCurve();
virtual ~RimPlotCurve();
void setColor(const cvf::Color3f& color);
void loadDataAndUpdate();
void setQwtTrack(QwtPlot* plot);
void setParentQwtPlot(QwtPlot* plot);
void detachQwtCurve();
QwtPlotCurve* qwtPlotCurve() const;
void setColor(const cvf::Color3f& color);
bool isCurveVisible() const;
QwtPlotCurve* plotCurve() const;
QString name() const { return m_curveName; }
void updateCurveName();
void updatePlotTitle();
virtual void updatePlotData() = 0;
QString curveName() const { return m_curveName; }
protected:
virtual QString createCurveName() = 0;
virtual QString createCurveAutoName() = 0;
virtual void zoomAllParentPlot() = 0;
virtual void onLoadDataAndUpdate() = 0;
void updatePlotConfiguration();
void updateCurvePresentation();
void updateCurveName();
void updateCurveVisibility();
virtual void zoomAllOwnerTrackAndPlot() = 0;
void updateOptionSensitivity();
void updateCurveAppearance();
void updateOptionSensitivity();
protected:
// Overridden PDM methods
@@ -169,14 +166,14 @@ protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
protected:
QPointer<QwtPlot> m_ownerQwtTrack;
QPointer<QwtPlot> m_parentQwtPlot;
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_curveName;
caf::PdmField<QString> m_customCurveName;
caf::PdmField<bool> m_autoName;
caf::PdmField<bool> m_isUsingAutoName;
caf::PdmField<cvf::Color3f> m_curveColor;
caf::PdmField<float> m_curveThickness;
@@ -207,7 +204,7 @@ public:
virtual QString wellDate() const { return ""; };
protected:
void zoomAllOwnerTrackAndPlot() override;
virtual void zoomAllParentPlot();
cvf::ref<RigWellLogCurveData> m_curveData;
};

View File

@@ -165,15 +165,15 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
{
clampTimestep();
this->updatePlotData();
this->loadDataAndUpdate();
}
else if (changedField == &m_wellPath)
{
this->updatePlotData();
this->loadDataAndUpdate();
}
else if (changedField == &m_timeStep)
{
this->updatePlotData();
this->loadDataAndUpdate();
}
if (changedField == &m_addCaseNameToCurveName ||
@@ -184,16 +184,15 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
{
this->uiCapability()->updateConnectedEditors();
updateCurveName();
updatePlotTitle();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::updatePlotData()
void RimWellLogExtractionCurve::onLoadDataAndUpdate()
{
RimWellLogCurve::updatePlotConfiguration();
RimWellLogCurve::updateCurvePresentation();
if (isCurveVisible())
{
@@ -292,11 +291,11 @@ void RimWellLogExtractionCurve::updatePlotData()
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
zoomAllOwnerTrackAndPlot();
zoomAllParentPlot();
setLogScaleFromSelectedResult();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
}
@@ -403,8 +402,8 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
appearanceGroup->add(&m_pointSymbol);
appearanceGroup->add(&m_lineStyle);
appearanceGroup->add(&m_curveName);
appearanceGroup->add(&m_autoName);
if (m_autoName)
appearanceGroup->add(&m_isUsingAutoName);
if (m_isUsingAutoName)
{
appearanceGroup->add(&m_addWellNameToCurveName);
appearanceGroup->add(&m_addCaseNameToCurveName);
@@ -463,7 +462,7 @@ void RimWellLogExtractionCurve::setLogScaleFromSelectedResult()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogExtractionCurve::createCurveName()
QString RimWellLogExtractionCurve::createCurveAutoName()
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());

View File

@@ -41,7 +41,6 @@ public:
RimWellLogExtractionCurve();
virtual ~RimWellLogExtractionCurve();
virtual void updatePlotData();
void setWellPath(RimWellPath* wellPath);
void setPropertiesFromView(RimView* view);
@@ -51,7 +50,8 @@ public:
virtual QString wellDate() const;
protected:
virtual QString createCurveName();
virtual QString createCurveAutoName();
virtual void onLoadDataAndUpdate();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);

View File

@@ -68,9 +68,9 @@ RimWellLogFileCurve::~RimWellLogFileCurve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::updatePlotData()
void RimWellLogFileCurve::onLoadDataAndUpdate()
{
RimWellLogCurve::updatePlotConfiguration();
RimWellLogCurve::updateCurvePresentation();
if (isCurveVisible())
{
@@ -107,9 +107,9 @@ void RimWellLogFileCurve::updatePlotData()
}
}
if (m_autoName)
if (m_isUsingAutoName)
{
m_qwtPlotCurve->setTitle(createCurveName());
m_qwtPlotCurve->setTitle(createCurveAutoName());
}
}
}
@@ -123,9 +123,9 @@ void RimWellLogFileCurve::updatePlotData()
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
zoomAllOwnerTrackAndPlot();
zoomAllParentPlot();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
}
@@ -154,14 +154,14 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
if (changedField == &m_wellPath)
{
this->updatePlotData();
this->loadDataAndUpdate();
}
else if (changedField == &m_wellLogChannnelName)
{
this->updatePlotData();
this->loadDataAndUpdate();
}
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
@@ -179,7 +179,7 @@ void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
appearanceGroup->add(&m_pointSymbol);
appearanceGroup->add(&m_lineStyle);
appearanceGroup->add(&m_curveName);
appearanceGroup->add(&m_autoName);
appearanceGroup->add(&m_isUsingAutoName);
}
//--------------------------------------------------------------------------------------------------
@@ -251,7 +251,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const c
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::createCurveName()
QString RimWellLogFileCurve::createCurveAutoName()
{
if (m_wellPath)
{

View File

@@ -45,13 +45,13 @@ public:
void setWellLogChannelName(const QString& name);
// Overrides from RimWellLogPlotCurve
virtual void updatePlotData();
virtual QString wellName() const;
virtual QString wellLogChannelName() const;
protected:
// Overrides from RimWellLogPlotCurve
virtual QString createCurveName();
virtual QString createCurveAutoName();
virtual void onLoadDataAndUpdate();
// Pdm overrrides
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);

View File

@@ -160,7 +160,7 @@ void RimWellLogTrack::addCurve(RimWellLogCurve* curve)
if (m_wellLogTrackPlotWidget)
{
curve->setQwtTrack(m_wellLogTrackPlotWidget);
curve->setParentQwtPlot(m_wellLogTrackPlotWidget);
}
}
@@ -174,7 +174,7 @@ void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index)
if (m_wellLogTrackPlotWidget)
{
curve->setQwtTrack(m_wellLogTrackPlotWidget);
curve->setParentQwtPlot(m_wellLogTrackPlotWidget);
}
}
@@ -249,7 +249,7 @@ void RimWellLogTrack::loadDataAndUpdate()
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
{
curves[cIdx]->updatePlotData();
curves[cIdx]->loadDataAndUpdate();
}
}
@@ -265,7 +265,7 @@ void RimWellLogTrack::recreateViewer()
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
{
curves[cIdx]->setQwtTrack(this->m_wellLogTrackPlotWidget);
curves[cIdx]->setParentQwtPlot(this->m_wellLogTrackPlotWidget);
}
}
}
@@ -353,7 +353,7 @@ RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* c
{
for (size_t idx = 0; idx < curves.size(); idx++)
{
if (curves[idx]->plotCurve() == curve)
if (curves[idx]->qwtPlotCurve() == curve)
{
return curves[idx];
}