Add deleteAllCurves method, and rename removeCurve to takeOutCurve in order to minimize wrong use.

This commit is contained in:
Jacob Støren 2017-11-15 10:41:00 +01:00
parent f14eb44efd
commit 07264140cb
4 changed files with 16 additions and 11 deletions

View File

@ -46,7 +46,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrac
curve->firstAncestorOrThisOfType(wellLogPlotTrack); curve->firstAncestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack) if (wellLogPlotTrack)
{ {
wellLogPlotTrack->removeCurve(curve); wellLogPlotTrack->takeOutCurve(curve);
wellLogPlotTrack->updateConnectedEditors(); wellLogPlotTrack->updateConnectedEditors();
srcTracks.insert(wellLogPlotTrack); srcTracks.insert(wellLogPlotTrack);
RimWellLogPlot* plot; RimWellLogPlot* plot;

View File

@ -521,10 +521,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0); RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
// Delete curves // Delete curves
for (RimWellLogCurve* const curve : curvesToDelete) plotTrack->deleteAllCurves();
{
plotTrack->removeCurve(curve);
}
// Add new curves // Add new curves
for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefsToAdd) for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefsToAdd)
@ -796,10 +793,8 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
if (changedField == &m_wellPathNameOrSimWellName || changedField == &m_branchIndex) if (changedField == &m_wellPathNameOrSimWellName || changedField == &m_branchIndex)
{ {
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0); RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
for (RimWellLogCurve* const curve : plotTrack->curvesVector()) plotTrack->deleteAllCurves();
{
plotTrack->removeCurve(curve);
}
m_timeStepsToAddresses.clear(); m_timeStepsToAddresses.clear();
updateEditorsFromCurves(); updateEditorsFromCurves();
updateFormationsOnPlot(); updateFormationsOnPlot();

View File

@ -391,7 +391,7 @@ void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::removeCurve(RimWellLogCurve* curve) void RimWellLogTrack::takeOutCurve(RimWellLogCurve* curve)
{ {
size_t index = curves.index(curve); size_t index = curves.index(curve);
if ( index < curves.size()) if ( index < curves.size())
@ -401,6 +401,14 @@ void RimWellLogTrack::removeCurve(RimWellLogCurve* curve)
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::deleteAllCurves()
{
curves.deleteAllChildObjects();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -73,7 +73,9 @@ public:
bool isVisible(); bool isVisible();
void addCurve(RimWellLogCurve* curve); void addCurve(RimWellLogCurve* curve);
void insertCurve(RimWellLogCurve* curve, size_t index); void insertCurve(RimWellLogCurve* curve, size_t index);
void removeCurve(RimWellLogCurve* curve); void takeOutCurve(RimWellLogCurve* curve);
void deleteAllCurves();
size_t curveIndex(RimWellLogCurve* curve); size_t curveIndex(RimWellLogCurve* curve);
size_t curveCount() { return curves.size(); } size_t curveCount() { return curves.size(); }
void setXAxisTitle(const QString& text); void setXAxisTitle(const QString& text);