mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
(#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:
@@ -44,13 +44,25 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
|
|||||||
oldPlotTrack->updateConnectedEditors();
|
oldPlotTrack->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
wellLogPlotTrack->addCurve(curves[cIdx]);
|
wellLogPlotTrack->insertCurve(curves[cIdx], cIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
wellLogPlotTrack->updateAxisRangesAndReplot();
|
wellLogPlotTrack->updateAxisRangesAndReplot();
|
||||||
wellLogPlotTrack->updateConnectedEditors();
|
wellLogPlotTrack->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* wellLogPlotTrack, const std::vector<RimWellLogPlotCurve*>& curves, RimWellLogPlotCurve* insertAfterCurve)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(wellLogPlotTrack && insertAfterCurve);
|
||||||
|
|
||||||
|
wellLogPlotTrack->moveCurves(insertAfterCurve, curves);
|
||||||
|
wellLogPlotTrack->updateAxisRangesAndReplot();
|
||||||
|
wellLogPlotTrack->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class RicWellLogPlotTrackFeatureImpl
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* wellLogPlotTrack, const std::vector<RimWellLogPlotCurve*>& curves);
|
static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* wellLogPlotTrack, const std::vector<RimWellLogPlotCurve*>& curves);
|
||||||
|
static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* wellLogPlotTrack, const std::vector<RimWellLogPlotCurve*>& curves, RimWellLogPlotCurve* insertAfterCurve);
|
||||||
static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot, const std::vector<RimWellLogPlotTrack*>& tracks);
|
static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot, const std::vector<RimWellLogPlotTrack*>& tracks);
|
||||||
static void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks);
|
static void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
void insertTrack(RimWellLogPlotTrack* track, size_t index);
|
void insertTrack(RimWellLogPlotTrack* track, size_t index);
|
||||||
size_t trackCount() { return tracks.size();}
|
size_t trackCount() { return tracks.size();}
|
||||||
void removeTrack(RimWellLogPlotTrack* track);
|
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 loadDataAndUpdate();
|
||||||
void updateTracks();
|
void updateTracks();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ public:
|
|||||||
void setDescription(const QString& description);
|
void setDescription(const QString& description);
|
||||||
|
|
||||||
void addCurve(RimWellLogPlotCurve* curve);
|
void addCurve(RimWellLogPlotCurve* curve);
|
||||||
|
void insertCurve(RimWellLogPlotCurve* curve, size_t index);
|
||||||
void removeCurve(RimWellLogPlotCurve* curve);
|
void removeCurve(RimWellLogPlotCurve* curve);
|
||||||
|
void moveCurves(RimWellLogPlotCurve* insertAfterCurve, const std::vector<RimWellLogPlotCurve*>& curvesToMove);
|
||||||
size_t curveCount() { return curves.size(); }
|
size_t curveCount() { return curves.size(); }
|
||||||
|
|
||||||
void recreateViewer();
|
void recreateViewer();
|
||||||
|
|||||||
@@ -241,6 +241,13 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int
|
|||||||
return handleGridCaseGroupDrop(action, objectGroup, gridCaseGroup);
|
return handleGridCaseGroupDrop(action, objectGroup, gridCaseGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimWellLogPlotCurve* wellLogPlotCurve;
|
||||||
|
objHandle->firstAnchestorOrThisOfType(wellLogPlotCurve);
|
||||||
|
if (wellLogPlotCurve)
|
||||||
|
{
|
||||||
|
return handleWellLogPlotCurveDrop(action, objectGroup, wellLogPlotCurve);
|
||||||
|
}
|
||||||
|
|
||||||
RimWellLogPlotTrack* wellLogPlotTrack;
|
RimWellLogPlotTrack* wellLogPlotTrack;
|
||||||
objHandle->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
objHandle->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
||||||
if (wellLogPlotTrack)
|
if (wellLogPlotTrack)
|
||||||
@@ -361,6 +368,27 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotCurve* wellLogPlotCurve)
|
||||||
|
{
|
||||||
|
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(objectGroup);
|
||||||
|
if (wellLogPlotCurves.size() > 0)
|
||||||
|
{
|
||||||
|
if (action == Qt::MoveAction)
|
||||||
|
{
|
||||||
|
RimWellLogPlotTrack* wellLogPlotTrack;
|
||||||
|
wellLogPlotCurve->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
||||||
|
|
||||||
|
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, wellLogPlotCurve);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ namespace caf
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RimIdenticalGridCaseGroup;
|
class RimIdenticalGridCaseGroup;
|
||||||
class RimWellLogPlotTrack;
|
|
||||||
class RimWellLogPlot;
|
class RimWellLogPlot;
|
||||||
|
class RimWellLogPlotTrack;
|
||||||
|
class RimWellLogPlotCurve;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -56,6 +57,7 @@ private:
|
|||||||
bool handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
|
bool handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
|
||||||
bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotTrack* wellLogPlotTrack);
|
bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotTrack* wellLogPlotTrack);
|
||||||
bool handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot);
|
bool handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot);
|
||||||
|
bool handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotCurve* wellLogPlotCurve);
|
||||||
|
|
||||||
static void objectGroupFromModelIndexes(caf::PdmObjectGroup* objectGroup, const QModelIndexList &indexes);
|
static void objectGroupFromModelIndexes(caf::PdmObjectGroup* objectGroup, const QModelIndexList &indexes);
|
||||||
static std::vector<caf::PdmPointer<caf::PdmObjectHandle> > objectHandlesFromSelection();
|
static std::vector<caf::PdmPointer<caf::PdmObjectHandle> > objectHandlesFromSelection();
|
||||||
|
|||||||
Reference in New Issue
Block a user