(#467) Moving curves onto a track inserts them in front of existing curves

Dragging and dropping curves onto a curve appends curves after the given
curve.
This commit is contained in:
Pål Hagen
2015-10-22 16:56:10 +02:00
parent b18ae1a14a
commit e9f94fc959
7 changed files with 86 additions and 3 deletions

View File

@@ -56,7 +56,7 @@ public:
void insertTrack(RimWellLogPlotTrack* track, size_t index);
size_t trackCount() { return tracks.size();}
void removeTrack(RimWellLogPlotTrack* track);
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks);
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove);
void loadDataAndUpdate();
void updateTracks();

View File

@@ -118,6 +118,19 @@ void RimWellLogPlotTrack::addCurve(RimWellLogPlotCurve* curve)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index)
{
curves.insert(index, curve);
if (m_wellLogTrackPlotWidget)
{
curve->setPlot(m_wellLogTrackPlotWidget);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -131,6 +144,31 @@ void RimWellLogPlotTrack::removeCurve(RimWellLogPlotCurve* curve)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::moveCurves(RimWellLogPlotCurve* insertAfterCurve, const std::vector<RimWellLogPlotCurve*>& curvesToMove)
{
for (size_t cIdx = 0; cIdx < curvesToMove.size(); cIdx++)
{
RimWellLogPlotCurve* curve = curvesToMove[cIdx];
RimWellLogPlotTrack* wellLogPlotTrack;
curve->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{
wellLogPlotTrack->removeCurve(curve);
wellLogPlotTrack->updateConnectedEditors();
}
}
size_t index = curves.index(insertAfterCurve) + 1;
for (size_t cIdx = 0; cIdx < curvesToMove.size(); cIdx++)
{
insertCurve(curvesToMove[cIdx], index + cIdx);
}
}
//--------------------------------------------------------------------------------------------------
///

View File

@@ -46,7 +46,9 @@ public:
void setDescription(const QString& description);
void addCurve(RimWellLogPlotCurve* curve);
void insertCurve(RimWellLogPlotCurve* curve, size_t index);
void removeCurve(RimWellLogPlotCurve* curve);
void moveCurves(RimWellLogPlotCurve* insertAfterCurve, const std::vector<RimWellLogPlotCurve*>& curvesToMove);
size_t curveCount() { return curves.size(); }
void recreateViewer();