mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#592) Refactored and renamed to make ready to fix for Track operations
This commit is contained in:
parent
07916f55ce
commit
0d41d15fe9
@ -82,37 +82,42 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot, const std::vector<RimWellLogPlotTrack*>& tracks)
|
void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dstWellLogPlot,
|
||||||
|
const std::vector<RimWellLogPlotTrack*>& tracksToMove,
|
||||||
|
RimWellLogPlotTrack* trackToInsertAfter)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(wellLogPlot);
|
CVF_ASSERT(dstWellLogPlot);
|
||||||
|
|
||||||
RimWellLogPlotTrack* wellLogPlotTrack = NULL;
|
RimWellLogPlotTrack* track = NULL;
|
||||||
|
|
||||||
for (size_t tIdx = 0; tIdx < tracks.size(); tIdx++)
|
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
|
||||||
{
|
{
|
||||||
wellLogPlotTrack = tracks[tIdx];
|
track = tracksToMove[tIdx];
|
||||||
|
|
||||||
RimWellLogPlot* oldPlot;
|
RimWellLogPlot* oldPlot;
|
||||||
wellLogPlotTrack->firstAnchestorOrThisOfType(oldPlot);
|
track->firstAnchestorOrThisOfType(oldPlot);
|
||||||
if (oldPlot)
|
if (oldPlot)
|
||||||
{
|
{
|
||||||
oldPlot->removeTrack(wellLogPlotTrack);
|
oldPlot->removeTrack(track);
|
||||||
oldPlot->updateTrackNames();
|
oldPlot->updateTrackNames();
|
||||||
oldPlot->updateConnectedEditors();
|
oldPlot->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wellLogPlot->insertTrack(wellLogPlotTrack, tIdx);
|
size_t insertionStartIndex = 0;
|
||||||
}
|
if (trackToInsertAfter) insertionStartIndex = dstWellLogPlot->trackIndex(trackToInsertAfter) + 1;
|
||||||
|
|
||||||
wellLogPlot->updateTracks();
|
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
|
||||||
wellLogPlot->updateConnectedEditors();
|
|
||||||
|
|
||||||
if (wellLogPlotTrack)
|
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(wellLogPlotTrack);
|
dstWellLogPlot->insertTrack(tracksToMove[tIdx], insertionStartIndex + tIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dstWellLogPlot->updateTrackNames();
|
||||||
|
dstWellLogPlot->updateTracks();
|
||||||
|
dstWellLogPlot->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -128,3 +133,4 @@ void RicWellLogPlotTrackFeatureImpl::moveTracks(RimWellLogPlotTrack* insertAfter
|
|||||||
wellLogPlot->updateConnectedEditors();
|
wellLogPlot->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
@ -32,7 +32,11 @@ class RicWellLogPlotTrackFeatureImpl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* dstTrack, const std::vector<RimWellLogPlotCurve*>& curves, RimWellLogPlotCurve* insertAfterCurve);
|
static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* dstTrack,
|
||||||
static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot, const std::vector<RimWellLogPlotTrack*>& tracks);
|
const std::vector<RimWellLogPlotCurve*>& curves,
|
||||||
static void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks);
|
RimWellLogPlotCurve* insertAfterCurve);
|
||||||
|
static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot,
|
||||||
|
const std::vector<RimWellLogPlotTrack*>& tracks,
|
||||||
|
RimWellLogPlotTrack* trackToInsertAfter);
|
||||||
|
//static void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks);
|
||||||
};
|
};
|
||||||
|
@ -529,3 +529,11 @@ QString RimWellLogPlot::depthPlotTitle() const
|
|||||||
return depthTitle;
|
return depthTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
size_t RimWellLogPlot::trackIndex(RimWellLogPlotTrack* track)
|
||||||
|
{
|
||||||
|
return m_tracks.index(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ public:
|
|||||||
void insertTrack(RimWellLogPlotTrack* track, size_t index);
|
void insertTrack(RimWellLogPlotTrack* track, size_t index);
|
||||||
size_t trackCount() { return m_tracks.size();}
|
size_t trackCount() { return m_tracks.size();}
|
||||||
void removeTrack(RimWellLogPlotTrack* track);
|
void removeTrack(RimWellLogPlotTrack* track);
|
||||||
|
size_t trackIndex(RimWellLogPlotTrack* track);
|
||||||
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove);
|
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove);
|
||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
|
@ -219,9 +219,9 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
|
|||||||
bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView();
|
caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||||
caf::PdmUiItem* dropTarget = uiTreeView->uiItemFromModelIndex(parent);
|
caf::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex(parent);
|
||||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(dropTarget);
|
caf::PdmObjectHandle* dropTarget = dynamic_cast<caf::PdmObjectHandle*>(dropTargetUiItem);
|
||||||
if (objHandle)
|
if (dropTarget)
|
||||||
{
|
{
|
||||||
caf::PdmObjectGroup draggedObjects;
|
caf::PdmObjectGroup draggedObjects;
|
||||||
const MimeDataWithIndexes* myMimeData = qobject_cast<const MimeDataWithIndexes*>(data);
|
const MimeDataWithIndexes* myMimeData = qobject_cast<const MimeDataWithIndexes*>(data);
|
||||||
@ -235,28 +235,28 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
RimIdenticalGridCaseGroup* gridCaseGroup;
|
RimIdenticalGridCaseGroup* gridCaseGroup;
|
||||||
objHandle->firstAnchestorOrThisOfType(gridCaseGroup);
|
dropTarget->firstAnchestorOrThisOfType(gridCaseGroup);
|
||||||
if (gridCaseGroup)
|
if (gridCaseGroup)
|
||||||
{
|
{
|
||||||
return handleGridCaseGroupDrop(action, draggedObjects, gridCaseGroup);
|
return handleGridCaseGroupDrop(action, draggedObjects, gridCaseGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
RimWellLogPlotCurve* wellLogPlotCurve;
|
RimWellLogPlotCurve* wellLogPlotCurve;
|
||||||
objHandle->firstAnchestorOrThisOfType(wellLogPlotCurve);
|
dropTarget->firstAnchestorOrThisOfType(wellLogPlotCurve);
|
||||||
if (wellLogPlotCurve)
|
if (wellLogPlotCurve)
|
||||||
{
|
{
|
||||||
return handleWellLogPlotCurveDrop(action, draggedObjects, wellLogPlotCurve);
|
return handleWellLogPlotCurveDrop(action, draggedObjects, wellLogPlotCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
RimWellLogPlotTrack* wellLogPlotTrack;
|
RimWellLogPlotTrack* wellLogPlotTrack;
|
||||||
objHandle->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
dropTarget->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
||||||
if (wellLogPlotTrack)
|
if (wellLogPlotTrack)
|
||||||
{
|
{
|
||||||
return handleWellLogPlotTrackDrop(action, draggedObjects, wellLogPlotTrack);
|
return handleWellLogPlotTrackDrop(action, draggedObjects, wellLogPlotTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
RimWellLogPlot* wellLogPlot;
|
RimWellLogPlot* wellLogPlot;
|
||||||
objHandle->firstAnchestorOrThisOfType(wellLogPlot);
|
dropTarget->firstAnchestorOrThisOfType(wellLogPlot);
|
||||||
if (wellLogPlot)
|
if (wellLogPlot)
|
||||||
{
|
{
|
||||||
return handleWellLogPlotDrop(action, draggedObjects, wellLogPlot);
|
return handleWellLogPlotDrop(action, draggedObjects, wellLogPlot);
|
||||||
@ -333,34 +333,36 @@ bool RiuDragDrop::handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectG
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotTrack* wellLogPlotTrack)
|
bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlotTrack* trackTarget)
|
||||||
{
|
{
|
||||||
std::vector<RimWellLogFileChannel*> wellLogFileChannels = RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup(objectGroup);
|
std::vector<RimWellLogFileChannel*> wellLogFileChannels = RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup(draggedObjects);
|
||||||
if (wellLogFileChannels.size() > 0)
|
if (wellLogFileChannels.size() > 0)
|
||||||
{
|
{
|
||||||
if (action == Qt::CopyAction)
|
if (action == Qt::CopyAction)
|
||||||
{
|
{
|
||||||
RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(wellLogPlotTrack, wellLogFileChannels);
|
RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(trackTarget, wellLogFileChannels);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(objectGroup);
|
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(draggedObjects);
|
||||||
if (wellLogPlotCurves.size() > 0)
|
if (wellLogPlotCurves.size() > 0)
|
||||||
{
|
{
|
||||||
if (action == Qt::MoveAction)
|
if (action == Qt::MoveAction)
|
||||||
{
|
{
|
||||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, NULL);
|
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(trackTarget, wellLogPlotCurves, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogPlotTrack>::typedObjectsFromGroup(objectGroup);
|
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogPlotTrack>::typedObjectsFromGroup(draggedObjects);
|
||||||
if (wellLogPlotTracks.size() > 0)
|
if (wellLogPlotTracks.size() > 0)
|
||||||
{
|
{
|
||||||
if (action == Qt::MoveAction)
|
if (action == Qt::MoveAction)
|
||||||
{
|
{
|
||||||
RicWellLogPlotTrackFeatureImpl::moveTracks(wellLogPlotTrack, wellLogPlotTracks);
|
RimWellLogPlot* wellLogPlot;
|
||||||
|
trackTarget->firstAnchestorOrThisOfType(wellLogPlot);
|
||||||
|
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(wellLogPlot, wellLogPlotTracks, trackTarget);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,17 +373,17 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotCurve* wellLogPlotCurve)
|
bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlotCurve* curveDropTarget)
|
||||||
{
|
{
|
||||||
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(objectGroup);
|
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(draggedObjects);
|
||||||
if (wellLogPlotCurves.size() > 0)
|
if (wellLogPlotCurves.size() > 0)
|
||||||
{
|
{
|
||||||
if (action == Qt::MoveAction)
|
if (action == Qt::MoveAction)
|
||||||
{
|
{
|
||||||
RimWellLogPlotTrack* wellLogPlotTrack;
|
RimWellLogPlotTrack* wellLogPlotTrack;
|
||||||
wellLogPlotCurve->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
curveDropTarget->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
||||||
|
|
||||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, wellLogPlotCurve);
|
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, curveDropTarget);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -392,14 +394,14 @@ bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObje
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiuDragDrop::handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot)
|
bool RiuDragDrop::handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlot* wellLogPlotTarget)
|
||||||
{
|
{
|
||||||
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogPlotTrack>::typedObjectsFromGroup(objectGroup);
|
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogPlotTrack>::typedObjectsFromGroup(draggedObjects);
|
||||||
if (wellLogPlotTracks.size() > 0)
|
if (wellLogPlotTracks.size() > 0)
|
||||||
{
|
{
|
||||||
if (action == Qt::MoveAction)
|
if (action == Qt::MoveAction)
|
||||||
{
|
{
|
||||||
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(wellLogPlot, wellLogPlotTracks);
|
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(wellLogPlotTarget, wellLogPlotTracks, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user