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);
if (wellLogPlotTrack)
{
wellLogPlotTrack->removeCurve(curve);
wellLogPlotTrack->takeOutCurve(curve);
wellLogPlotTrack->updateConnectedEditors();
srcTracks.insert(wellLogPlotTrack);
RimWellLogPlot* plot;

View File

@ -521,10 +521,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
// Delete curves
for (RimWellLogCurve* const curve : curvesToDelete)
{
plotTrack->removeCurve(curve);
}
plotTrack->deleteAllCurves();
// Add new curves
for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefsToAdd)
@ -796,10 +793,8 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
if (changedField == &m_wellPathNameOrSimWellName || changedField == &m_branchIndex)
{
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
for (RimWellLogCurve* const curve : plotTrack->curvesVector())
{
plotTrack->removeCurve(curve);
}
plotTrack->deleteAllCurves();
m_timeStepsToAddresses.clear();
updateEditorsFromCurves();
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);
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();
void addCurve(RimWellLogCurve* curve);
void insertCurve(RimWellLogCurve* curve, size_t index);
void removeCurve(RimWellLogCurve* curve);
void takeOutCurve(RimWellLogCurve* curve);
void deleteAllCurves();
size_t curveIndex(RimWellLogCurve* curve);
size_t curveCount() { return curves.size(); }
void setXAxisTitle(const QString& text);