mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Re-add missing drag and drop for well log tracks
This commit is contained in:
parent
77eafc6a6e
commit
bfaff27d51
@ -24,10 +24,6 @@
|
|||||||
#include "RiuQwtPlotWidget.h"
|
#include "RiuQwtPlotWidget.h"
|
||||||
#include "RiuWellLogPlot.h"
|
#include "RiuWellLogPlot.h"
|
||||||
|
|
||||||
#include "RimGridCrossPlot.h"
|
|
||||||
#include "RimGridCrossPlotCollection.h"
|
|
||||||
#include "RimSummaryPlot.h"
|
|
||||||
#include "RimSummaryPlotCollection.h"
|
|
||||||
#include "RimWellLogCurve.h"
|
#include "RimWellLogCurve.h"
|
||||||
#include "RimWellLogPlot.h"
|
#include "RimWellLogPlot.h"
|
||||||
#include "RimWellLogTrack.h"
|
#include "RimWellLogTrack.h"
|
||||||
@ -87,3 +83,33 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra
|
|||||||
destTrack->updateParentPlotZoom();
|
destTrack->updateParentPlotZoom();
|
||||||
destTrack->updateConnectedEditors();
|
destTrack->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot( RimWellLogPlot* wellLogPlot,
|
||||||
|
const std::vector<RimWellLogTrack*>& tracksToMove,
|
||||||
|
RimWellLogTrack* insertAfterTrack )
|
||||||
|
{
|
||||||
|
CVF_ASSERT( wellLogPlot );
|
||||||
|
|
||||||
|
for ( size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++ )
|
||||||
|
{
|
||||||
|
RimWellLogTrack* plot = tracksToMove[tIdx];
|
||||||
|
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
|
||||||
|
RimWellLogPlot* srcPlot;
|
||||||
|
pdmObject->firstAncestorOrThisOfType( srcPlot );
|
||||||
|
if ( srcPlot )
|
||||||
|
{
|
||||||
|
srcPlot->removePlot( plot );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t insertionStartIndex = 0;
|
||||||
|
if ( insertAfterTrack ) insertionStartIndex = wellLogPlot->plotIndex( insertAfterTrack ) + 1;
|
||||||
|
|
||||||
|
for ( size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++ )
|
||||||
|
{
|
||||||
|
wellLogPlot->insertPlot( tracksToMove[tIdx], insertionStartIndex + tIdx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class RimWellLogPlot;
|
||||||
class RimWellLogTrack;
|
class RimWellLogTrack;
|
||||||
class RimWellLogCurve;
|
class RimWellLogCurve;
|
||||||
|
|
||||||
@ -33,4 +34,7 @@ public:
|
|||||||
static void moveCurvesToWellLogPlotTrack( RimWellLogTrack* dstTrack,
|
static void moveCurvesToWellLogPlotTrack( RimWellLogTrack* dstTrack,
|
||||||
const std::vector<RimWellLogCurve*>& curves,
|
const std::vector<RimWellLogCurve*>& curves,
|
||||||
RimWellLogCurve* insertAfterCurve );
|
RimWellLogCurve* insertAfterCurve );
|
||||||
|
static void moveTracksToWellLogPlot( RimWellLogPlot* wellLogPlot,
|
||||||
|
const std::vector<RimWellLogTrack*>& tracks,
|
||||||
|
RimWellLogTrack* trackToInsertAfter );
|
||||||
};
|
};
|
||||||
|
@ -686,6 +686,8 @@ void RimDepthTrackPlot::onPlotAdditionOrRemoval()
|
|||||||
{
|
{
|
||||||
calculateAvailableDepthRange();
|
calculateAvailableDepthRange();
|
||||||
updateZoom();
|
updateZoom();
|
||||||
|
updateSubPlotNames();
|
||||||
|
updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -297,6 +297,20 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in
|
|||||||
return handleWellLogPlotCurveDrop( action, draggedObjects, wellLogPlotCurve );
|
return handleWellLogPlotCurveDrop( action, draggedObjects, wellLogPlotCurve );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimWellLogTrack* wellLogPlotTrack;
|
||||||
|
dropTarget->firstAncestorOrThisOfType( wellLogPlotTrack );
|
||||||
|
if ( wellLogPlotTrack )
|
||||||
|
{
|
||||||
|
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack, row );
|
||||||
|
}
|
||||||
|
|
||||||
|
RimWellLogPlot* wellLogPlot;
|
||||||
|
dropTarget->firstAncestorOrThisOfType( wellLogPlot );
|
||||||
|
if ( wellLogPlot )
|
||||||
|
{
|
||||||
|
return handleWellLogPlotDrop( action, draggedObjects, wellLogPlot, row );
|
||||||
|
}
|
||||||
|
|
||||||
RimMultiPlot* multiPlot;
|
RimMultiPlot* multiPlot;
|
||||||
dropTarget->firstAncestorOrThisOfType( multiPlot );
|
dropTarget->firstAncestorOrThisOfType( multiPlot );
|
||||||
if ( multiPlot )
|
if ( multiPlot )
|
||||||
@ -446,6 +460,93 @@ bool RiuDragDrop::handleWellLogPlotCurveDrop( Qt::DropAction action,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
|
||||||
|
caf::PdmObjectGroup& draggedObjects,
|
||||||
|
RimWellLogTrack* trackTarget,
|
||||||
|
int insertAtPosition )
|
||||||
|
{
|
||||||
|
std::vector<RimWellLogFileChannel*> wellLogFileChannels =
|
||||||
|
RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup( draggedObjects );
|
||||||
|
if ( wellLogFileChannels.size() > 0 )
|
||||||
|
{
|
||||||
|
if ( action == Qt::CopyAction )
|
||||||
|
{
|
||||||
|
RicWellLogTools::addWellLogChannelsToPlotTrack( trackTarget, wellLogFileChannels );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<RimWellLogCurve*> wellLogPlotCurves =
|
||||||
|
RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup( draggedObjects );
|
||||||
|
if ( wellLogPlotCurves.size() > 0 )
|
||||||
|
{
|
||||||
|
if ( action == Qt::MoveAction )
|
||||||
|
{
|
||||||
|
RimWellLogCurve* insertAfter = nullptr;
|
||||||
|
if ( insertAtPosition > 0 )
|
||||||
|
{
|
||||||
|
auto visibleCurves = trackTarget->visibleCurves();
|
||||||
|
if ( !visibleCurves.empty() )
|
||||||
|
{
|
||||||
|
int insertAfterPosition = std::min( insertAtPosition - 1, (int)visibleCurves.size() - 1 );
|
||||||
|
insertAfter = visibleCurves[insertAfterPosition];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( trackTarget, wellLogPlotCurves, insertAfter );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<RimWellLogTrack*> wellLogPlotTracks =
|
||||||
|
RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup( draggedObjects );
|
||||||
|
if ( wellLogPlotTracks.size() > 0 )
|
||||||
|
{
|
||||||
|
if ( action == Qt::MoveAction )
|
||||||
|
{
|
||||||
|
RimWellLogPlot* wellLogPlot;
|
||||||
|
trackTarget->firstAncestorOrThisOfType( wellLogPlot );
|
||||||
|
return handleWellLogPlotDrop( action, draggedObjects, wellLogPlot, insertAtPosition );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuDragDrop::handleWellLogPlotDrop( Qt::DropAction action,
|
||||||
|
caf::PdmObjectGroup& draggedObjects,
|
||||||
|
RimWellLogPlot* wellLogPlotTarget,
|
||||||
|
int insertAtPosition )
|
||||||
|
{
|
||||||
|
std::vector<RimWellLogTrack*> wellLogPlotTracks =
|
||||||
|
RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup( draggedObjects );
|
||||||
|
if ( wellLogPlotTracks.size() > 0 )
|
||||||
|
{
|
||||||
|
if ( action == Qt::MoveAction )
|
||||||
|
{
|
||||||
|
RimWellLogTrack* insertAfter = nullptr;
|
||||||
|
if ( insertAtPosition > 0 )
|
||||||
|
{
|
||||||
|
auto visibleTracks = wellLogPlotTarget->visiblePlots();
|
||||||
|
if ( !visibleTracks.empty() )
|
||||||
|
{
|
||||||
|
int insertAfterPosition = std::min( insertAtPosition - 1, (int)visibleTracks.size() - 1 );
|
||||||
|
insertAfter = dynamic_cast<RimWellLogTrack*>( visibleTracks[insertAfterPosition] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot( wellLogPlotTarget, wellLogPlotTracks, insertAfter );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -65,6 +65,12 @@ private:
|
|||||||
caf::PdmObjectGroup& objectGroup,
|
caf::PdmObjectGroup& objectGroup,
|
||||||
RimWellLogTrack* wellLogPlotTrack,
|
RimWellLogTrack* wellLogPlotTrack,
|
||||||
int insertAtPosition );
|
int insertAtPosition );
|
||||||
|
|
||||||
|
bool handleWellLogPlotDrop( Qt::DropAction action,
|
||||||
|
caf::PdmObjectGroup& objectGroup,
|
||||||
|
RimWellLogPlot* wellLogPlot,
|
||||||
|
int insertAtPosition );
|
||||||
|
|
||||||
bool handleMultiPlotDrop( Qt::DropAction action,
|
bool handleMultiPlotDrop( Qt::DropAction action,
|
||||||
caf::PdmObjectGroup& objectGroup,
|
caf::PdmObjectGroup& objectGroup,
|
||||||
RimMultiPlot* multiPlot,
|
RimMultiPlot* multiPlot,
|
||||||
|
Loading…
Reference in New Issue
Block a user