mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -37,54 +37,53 @@
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RicWellLogTools.h"
|
||||
|
||||
#include "cafPdmUiItem.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QModelIndex>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
class RiuTypedPdmObjects
|
||||
{
|
||||
public:
|
||||
explicit RiuTypedPdmObjects(const caf::PdmObjectGroup& objectGroup)
|
||||
explicit RiuTypedPdmObjects( const caf::PdmObjectGroup& objectGroup )
|
||||
{
|
||||
objectGroup.objectsByType(&m_typedObjects);
|
||||
objectGroup.objectsByType( &m_typedObjects );
|
||||
}
|
||||
|
||||
explicit RiuTypedPdmObjects(const std::vector<caf::PdmPointer<caf::PdmObjectHandle> >& objectHandles)
|
||||
explicit RiuTypedPdmObjects( const std::vector<caf::PdmPointer<caf::PdmObjectHandle>>& objectHandles )
|
||||
{
|
||||
for (size_t i = 0; i < objectHandles.size(); i++)
|
||||
for ( size_t i = 0; i < objectHandles.size(); i++ )
|
||||
{
|
||||
T* obj = dynamic_cast<T*>(objectHandles[i].p());
|
||||
if (obj) m_typedObjects.push_back(obj);
|
||||
T* obj = dynamic_cast<T*>( objectHandles[i].p() );
|
||||
if ( obj ) m_typedObjects.push_back( obj );
|
||||
}
|
||||
}
|
||||
|
||||
static std::vector<T*> typedObjectsFromGroup(const caf::PdmObjectGroup& objectGroup)
|
||||
static std::vector<T*> typedObjectsFromGroup( const caf::PdmObjectGroup& objectGroup )
|
||||
{
|
||||
RiuTypedPdmObjects<T> typedObjectsGetter(objectGroup);
|
||||
RiuTypedPdmObjects<T> typedObjectsGetter( objectGroup );
|
||||
return typedObjectsGetter.typedObjects();
|
||||
}
|
||||
|
||||
static bool containsTypedObjects(const caf::PdmObjectGroup& objectGroup)
|
||||
static bool containsTypedObjects( const caf::PdmObjectGroup& objectGroup )
|
||||
{
|
||||
RiuTypedPdmObjects<T> typedObjectsGetter(objectGroup);
|
||||
RiuTypedPdmObjects<T> typedObjectsGetter( objectGroup );
|
||||
return typedObjectsGetter.typedObjects().size() > 0;
|
||||
}
|
||||
|
||||
static bool containsTypedObjects(const std::vector<caf::PdmPointer<caf::PdmObjectHandle> >& objectHandles)
|
||||
static bool containsTypedObjects( const std::vector<caf::PdmPointer<caf::PdmObjectHandle>>& objectHandles )
|
||||
{
|
||||
RiuTypedPdmObjects<T> typedObjectsGetter(objectHandles);
|
||||
RiuTypedPdmObjects<T> typedObjectsGetter( objectHandles );
|
||||
return typedObjectsGetter.typedObjects().size() > 0;
|
||||
}
|
||||
|
||||
@@ -92,21 +91,20 @@ private:
|
||||
std::vector<T*> typedObjects()
|
||||
{
|
||||
std::vector<T*> typedObjectsVec;
|
||||
for (size_t i = 0; i < m_typedObjects.size(); i++)
|
||||
for ( size_t i = 0; i < m_typedObjects.size(); i++ )
|
||||
{
|
||||
typedObjectsVec.push_back(m_typedObjects[i].p());
|
||||
typedObjectsVec.push_back( m_typedObjects[i].p() );
|
||||
}
|
||||
|
||||
return typedObjectsVec;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<caf::PdmPointer<T> > m_typedObjects;
|
||||
std::vector<caf::PdmPointer<T>> m_typedObjects;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuDragDrop::RiuDragDrop()
|
||||
{
|
||||
@@ -114,25 +112,23 @@ RiuDragDrop::RiuDragDrop()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuDragDrop::~RiuDragDrop()
|
||||
{
|
||||
}
|
||||
RiuDragDrop::~RiuDragDrop() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Qt::DropActions RiuDragDrop::supportedDropActions() const
|
||||
{
|
||||
// Keep drag items so that we can determine allowed actions while dragging
|
||||
// Keep drag items so that we can determine allowed actions while dragging
|
||||
m_dragItems = objectHandlesFromSelection();
|
||||
|
||||
if (RiuTypedPdmObjects<RimEclipseCase>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimEclipseCase>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
return Qt::CopyAction | Qt::MoveAction;
|
||||
}
|
||||
else if (RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects(m_dragItems))
|
||||
else if ( RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
@@ -141,103 +137,101 @@ Qt::DropActions RiuDragDrop::supportedDropActions() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
|
||||
Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
|
||||
{
|
||||
Qt::ItemFlags itemflags = nullptr;
|
||||
|
||||
if (index.isValid())
|
||||
if ( index.isValid() )
|
||||
{
|
||||
caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex(index);
|
||||
caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex( index );
|
||||
|
||||
caf::PdmObject* pdmObj = dynamic_cast<caf::PdmObject*>(uiItem);
|
||||
if (pdmObj)
|
||||
caf::PdmObject* pdmObj = dynamic_cast<caf::PdmObject*>( uiItem );
|
||||
if ( pdmObj )
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = nullptr;
|
||||
pdmObj->firstAncestorOrThisOfType(wellAllocationPlot);
|
||||
if (wellAllocationPlot) return itemflags;
|
||||
pdmObj->firstAncestorOrThisOfType( wellAllocationPlot );
|
||||
if ( wellAllocationPlot ) return itemflags;
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimEclipseCase*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogCurve*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogFileChannel*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogTrack*>(uiItem) ||
|
||||
dynamic_cast<RimSummaryCase*>(uiItem))
|
||||
if ( dynamic_cast<RimEclipseCase*>( uiItem ) || dynamic_cast<RimWellLogCurve*>( uiItem ) ||
|
||||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimWellLogTrack*>( uiItem ) ||
|
||||
dynamic_cast<RimSummaryCase*>( uiItem ) )
|
||||
{
|
||||
// TODO: Remember to handle reservoir holding the main grid
|
||||
itemflags |= Qt::ItemIsDragEnabled;
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimEclipseCase*>(uiItem) || dynamic_cast<RimCaseCollection*>(uiItem))
|
||||
if ( dynamic_cast<RimEclipseCase*>( uiItem ) || dynamic_cast<RimCaseCollection*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimEclipseCase>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimEclipseCase>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (m_proposedDropAction == Qt::MoveAction)
|
||||
else if ( m_proposedDropAction == Qt::MoveAction )
|
||||
{
|
||||
if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||
if ( dynamic_cast<RimWellLogPlot*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimWellLogTrack>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimWellLogTrack>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
|
||||
else if ( dynamic_cast<RimWellLogTrack*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
else if (RiuTypedPdmObjects<RimWellLogTrack>::containsTypedObjects(m_dragItems))
|
||||
else if ( RiuTypedPdmObjects<RimWellLogTrack>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
|
||||
else if ( dynamic_cast<RimWellLogCurve*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCase*>(uiItem))
|
||||
else if ( dynamic_cast<RimSummaryCase*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimSummaryCase>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimSummaryCase>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCaseCollection*>(uiItem))
|
||||
else if ( dynamic_cast<RimSummaryCaseCollection*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimSummaryCase>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimSummaryCase>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCaseMainCollection*>(uiItem))
|
||||
else if ( dynamic_cast<RimSummaryCaseMainCollection*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimSummaryCase>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimSummaryCase>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_proposedDropAction == Qt::CopyAction)
|
||||
else if ( m_proposedDropAction == Qt::CopyAction )
|
||||
{
|
||||
if (dynamic_cast<RimWellLogTrack*>(uiItem))
|
||||
if ( dynamic_cast<RimWellLogTrack*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
|
||||
else if ( dynamic_cast<RimWellLogCurve*>( uiItem ) )
|
||||
{
|
||||
if (RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects(m_dragItems))
|
||||
if ( RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
}
|
||||
@@ -249,20 +243,20 @@ 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::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex(parent);
|
||||
caf::PdmObjectHandle* dropTarget = dynamic_cast<caf::PdmObjectHandle*>(dropTargetUiItem);
|
||||
if (dropTarget)
|
||||
caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
caf::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex( parent );
|
||||
caf::PdmObjectHandle* dropTarget = dynamic_cast<caf::PdmObjectHandle*>( dropTargetUiItem );
|
||||
if ( dropTarget )
|
||||
{
|
||||
caf::PdmObjectGroup draggedObjects;
|
||||
const MimeDataWithIndexes* myMimeData = qobject_cast<const MimeDataWithIndexes*>(data);
|
||||
if (myMimeData && parent.isValid())
|
||||
caf::PdmObjectGroup draggedObjects;
|
||||
const MimeDataWithIndexes* myMimeData = qobject_cast<const MimeDataWithIndexes*>( data );
|
||||
if ( myMimeData && parent.isValid() )
|
||||
{
|
||||
objectGroupFromModelIndexes(&draggedObjects, myMimeData->indexes());
|
||||
objectGroupFromModelIndexes( &draggedObjects, myMimeData->indexes() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -270,45 +264,45 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int
|
||||
}
|
||||
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup;
|
||||
dropTarget->firstAncestorOrThisOfType(gridCaseGroup);
|
||||
if (gridCaseGroup)
|
||||
dropTarget->firstAncestorOrThisOfType( gridCaseGroup );
|
||||
if ( gridCaseGroup )
|
||||
{
|
||||
return handleGridCaseGroupDrop(action, draggedObjects, gridCaseGroup);
|
||||
return handleGridCaseGroupDrop( action, draggedObjects, gridCaseGroup );
|
||||
}
|
||||
|
||||
RimWellLogCurve* wellLogPlotCurve;
|
||||
dropTarget->firstAncestorOrThisOfType(wellLogPlotCurve);
|
||||
if (wellLogPlotCurve)
|
||||
dropTarget->firstAncestorOrThisOfType( wellLogPlotCurve );
|
||||
if ( wellLogPlotCurve )
|
||||
{
|
||||
return handleWellLogPlotCurveDrop(action, draggedObjects, wellLogPlotCurve);
|
||||
return handleWellLogPlotCurveDrop( action, draggedObjects, wellLogPlotCurve );
|
||||
}
|
||||
|
||||
RimWellLogTrack* wellLogPlotTrack;
|
||||
dropTarget->firstAncestorOrThisOfType(wellLogPlotTrack);
|
||||
if (wellLogPlotTrack)
|
||||
dropTarget->firstAncestorOrThisOfType( wellLogPlotTrack );
|
||||
if ( wellLogPlotTrack )
|
||||
{
|
||||
return handleWellLogPlotTrackDrop(action, draggedObjects, wellLogPlotTrack);
|
||||
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack );
|
||||
}
|
||||
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
dropTarget->firstAncestorOrThisOfType(wellLogPlot);
|
||||
if (wellLogPlot)
|
||||
dropTarget->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
return handleWellLogPlotDrop(action, draggedObjects, wellLogPlot);
|
||||
return handleWellLogPlotDrop( action, draggedObjects, wellLogPlot );
|
||||
}
|
||||
|
||||
RimSummaryCaseCollection* summaryCaseCollection;
|
||||
dropTarget->firstAncestorOrThisOfType(summaryCaseCollection);
|
||||
if (summaryCaseCollection)
|
||||
dropTarget->firstAncestorOrThisOfType( summaryCaseCollection );
|
||||
if ( summaryCaseCollection )
|
||||
{
|
||||
return handleSummaryCaseCollectionDrop(action, draggedObjects, summaryCaseCollection);
|
||||
return handleSummaryCaseCollectionDrop( action, draggedObjects, summaryCaseCollection );
|
||||
}
|
||||
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection;
|
||||
dropTarget->firstAncestorOrThisOfType(summaryCaseMainCollection);
|
||||
if (summaryCaseMainCollection)
|
||||
dropTarget->firstAncestorOrThisOfType( summaryCaseMainCollection );
|
||||
if ( summaryCaseMainCollection )
|
||||
{
|
||||
return handleSummaryCaseMainCollectionDrop(action, draggedObjects, summaryCaseMainCollection);
|
||||
return handleSummaryCaseMainCollectionDrop( action, draggedObjects, summaryCaseMainCollection );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,18 +310,18 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QMimeData* RiuDragDrop::mimeData(const QModelIndexList &indexes) const
|
||||
QMimeData* RiuDragDrop::mimeData( const QModelIndexList& indexes ) const
|
||||
{
|
||||
MimeDataWithIndexes* myObj = new MimeDataWithIndexes();
|
||||
myObj->setIndexes(indexes);
|
||||
|
||||
myObj->setIndexes( indexes );
|
||||
|
||||
return myObj;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiuDragDrop::mimeTypes() const
|
||||
{
|
||||
@@ -337,7 +331,7 @@ QStringList RiuDragDrop::mimeTypes() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuDragDrop::onDragCanceled()
|
||||
{
|
||||
@@ -345,73 +339,81 @@ void RiuDragDrop::onDragCanceled()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuDragDrop::moveCasesToGridGroup(caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup)
|
||||
void RiuDragDrop::moveCasesToGridGroup( caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup )
|
||||
{
|
||||
std::vector<RimEclipseCase*> casesToBeDeleted = RiuTypedPdmObjects<RimEclipseCase>::typedObjectsFromGroup(objectGroup);
|
||||
std::vector<RimEclipseCase*> casesToBeDeleted = RiuTypedPdmObjects<RimEclipseCase>::typedObjectsFromGroup(
|
||||
objectGroup );
|
||||
|
||||
if (RicCloseCaseFeature::userConfirmedGridCaseGroupChange(casesToBeDeleted))
|
||||
if ( RicCloseCaseFeature::userConfirmedGridCaseGroupChange( casesToBeDeleted ) )
|
||||
{
|
||||
RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(objectGroup, gridCaseGroup);
|
||||
|
||||
for (size_t i = 0; i < casesToBeDeleted.size(); i++)
|
||||
RicPasteEclipseCasesFeature::addCasesToGridCaseGroup( objectGroup, gridCaseGroup );
|
||||
|
||||
for ( size_t i = 0; i < casesToBeDeleted.size(); i++ )
|
||||
{
|
||||
RicCloseCaseFeature::deleteEclipseCase(casesToBeDeleted[i]);
|
||||
RicCloseCaseFeature::deleteEclipseCase( casesToBeDeleted[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup)
|
||||
bool RiuDragDrop::handleGridCaseGroupDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& objectGroup,
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup )
|
||||
{
|
||||
if (action == Qt::CopyAction)
|
||||
if ( action == Qt::CopyAction )
|
||||
{
|
||||
RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(objectGroup, gridCaseGroup);
|
||||
RicPasteEclipseCasesFeature::addCasesToGridCaseGroup( objectGroup, gridCaseGroup );
|
||||
}
|
||||
else if (action == Qt::MoveAction)
|
||||
else if ( action == Qt::MoveAction )
|
||||
{
|
||||
moveCasesToGridGroup(objectGroup, gridCaseGroup);
|
||||
moveCasesToGridGroup( objectGroup, gridCaseGroup );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogTrack* trackTarget)
|
||||
bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimWellLogTrack* trackTarget )
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> wellLogFileChannels = RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup(draggedObjects);
|
||||
if (wellLogFileChannels.size() > 0)
|
||||
std::vector<RimWellLogFileChannel*> wellLogFileChannels = RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogFileChannels.size() > 0 )
|
||||
{
|
||||
if (action == Qt::CopyAction)
|
||||
if ( action == Qt::CopyAction )
|
||||
{
|
||||
RicWellLogTools::addWellLogChannelsToPlotTrack(trackTarget, wellLogFileChannels);
|
||||
RicWellLogTools::addWellLogChannelsToPlotTrack( trackTarget, wellLogFileChannels );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(draggedObjects);
|
||||
if (wellLogPlotCurves.size() > 0)
|
||||
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogPlotCurves.size() > 0 )
|
||||
{
|
||||
if (action == Qt::MoveAction)
|
||||
if ( action == Qt::MoveAction )
|
||||
{
|
||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(trackTarget, wellLogPlotCurves, nullptr);
|
||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( trackTarget, wellLogPlotCurves, nullptr );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(draggedObjects);
|
||||
if (wellLogPlotTracks.size() > 0)
|
||||
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogPlotTracks.size() > 0 )
|
||||
{
|
||||
if (action == Qt::MoveAction)
|
||||
if ( action == Qt::MoveAction )
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
trackTarget->firstAncestorOrThisOfType(wellLogPlot);
|
||||
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(wellLogPlot, wellLogPlotTracks, trackTarget);
|
||||
trackTarget->firstAncestorOrThisOfType( wellLogPlot );
|
||||
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot( wellLogPlot, wellLogPlotTracks, trackTarget );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -420,16 +422,19 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlot* wellLogPlotTarget)
|
||||
bool RiuDragDrop::handleWellLogPlotDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimWellLogPlot* wellLogPlotTarget )
|
||||
{
|
||||
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(draggedObjects);
|
||||
if (wellLogPlotTracks.size() > 0)
|
||||
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogPlotTracks.size() > 0 )
|
||||
{
|
||||
if (action == Qt::MoveAction)
|
||||
if ( action == Qt::MoveAction )
|
||||
{
|
||||
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(wellLogPlotTarget, wellLogPlotTracks, nullptr);
|
||||
RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot( wellLogPlotTarget, wellLogPlotTracks, nullptr );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -438,19 +443,24 @@ bool RiuDragDrop::handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGro
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogCurve* curveDropTarget)
|
||||
bool RiuDragDrop::handleWellLogPlotCurveDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimWellLogCurve* curveDropTarget )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(draggedObjects);
|
||||
if (wellLogPlotCurves.size() > 0)
|
||||
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
if ( wellLogPlotCurves.size() > 0 )
|
||||
{
|
||||
if (action == Qt::MoveAction)
|
||||
if ( action == Qt::MoveAction )
|
||||
{
|
||||
RimWellLogTrack* wellLogPlotTrack;
|
||||
curveDropTarget->firstAncestorOrThisOfType(wellLogPlotTrack);
|
||||
curveDropTarget->firstAncestorOrThisOfType( wellLogPlotTrack );
|
||||
|
||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, curveDropTarget);
|
||||
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( wellLogPlotTrack,
|
||||
wellLogPlotCurves,
|
||||
curveDropTarget );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -459,33 +469,36 @@ bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObje
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleSummaryCaseCollectionDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimSummaryCaseCollection* summaryCaseDropTarget)
|
||||
bool RiuDragDrop::handleSummaryCaseCollectionDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimSummaryCaseCollection* summaryCaseDropTarget )
|
||||
{
|
||||
std::vector<RimSummaryCase*> summaryCases = RiuTypedPdmObjects<RimSummaryCase>::typedObjectsFromGroup(draggedObjects);
|
||||
std::vector<RimSummaryCase*> summaryCases = RiuTypedPdmObjects<RimSummaryCase>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
|
||||
if (action != Qt::MoveAction || summaryCases.size() == 0) return false;
|
||||
if ( action != Qt::MoveAction || summaryCases.size() == 0 ) return false;
|
||||
|
||||
for (RimSummaryCase* summaryCase : summaryCases)
|
||||
for ( RimSummaryCase* summaryCase : summaryCases )
|
||||
{
|
||||
RimSummaryCaseCollection* summaryCaseCollection;
|
||||
summaryCase->firstAncestorOrThisOfType(summaryCaseCollection);
|
||||
|
||||
if (summaryCaseCollection)
|
||||
summaryCase->firstAncestorOrThisOfType( summaryCaseCollection );
|
||||
|
||||
if ( summaryCaseCollection )
|
||||
{
|
||||
summaryCaseCollection->removeCase(summaryCase);
|
||||
summaryCaseDropTarget->addCase(summaryCase);
|
||||
summaryCaseCollection->removeCase( summaryCase );
|
||||
summaryCaseDropTarget->addCase( summaryCase );
|
||||
summaryCaseCollection->updateConnectedEditors();
|
||||
continue;
|
||||
}
|
||||
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection;
|
||||
summaryCase->firstAncestorOrThisOfType(summaryCaseMainCollection);
|
||||
if (summaryCaseMainCollection)
|
||||
summaryCase->firstAncestorOrThisOfType( summaryCaseMainCollection );
|
||||
if ( summaryCaseMainCollection )
|
||||
{
|
||||
summaryCaseMainCollection->removeCase(summaryCase);
|
||||
summaryCaseDropTarget->addCase(summaryCase);
|
||||
summaryCaseMainCollection->removeCase( summaryCase );
|
||||
summaryCaseDropTarget->addCase( summaryCase );
|
||||
summaryCaseMainCollection->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
@@ -494,75 +507,78 @@ bool RiuDragDrop::handleSummaryCaseCollectionDrop(Qt::DropAction action, caf::Pd
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuDragDrop::handleSummaryCaseMainCollectionDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimSummaryCaseMainCollection* summaryCaseDropTarget)
|
||||
bool RiuDragDrop::handleSummaryCaseMainCollectionDrop( Qt::DropAction action,
|
||||
caf::PdmObjectGroup& draggedObjects,
|
||||
RimSummaryCaseMainCollection* summaryCaseDropTarget )
|
||||
{
|
||||
std::vector<RimSummaryCase*> summaryCases = RiuTypedPdmObjects<RimSummaryCase>::typedObjectsFromGroup(draggedObjects);
|
||||
|
||||
if (action != Qt::MoveAction || summaryCases.size() == 0 ) return false;
|
||||
std::vector<RimSummaryCase*> summaryCases = RiuTypedPdmObjects<RimSummaryCase>::typedObjectsFromGroup(
|
||||
draggedObjects );
|
||||
|
||||
for (RimSummaryCase* summaryCase : summaryCases)
|
||||
if ( action != Qt::MoveAction || summaryCases.size() == 0 ) return false;
|
||||
|
||||
for ( RimSummaryCase* summaryCase : summaryCases )
|
||||
{
|
||||
RimSummaryCaseCollection* summaryCaseCollection;
|
||||
summaryCase->firstAncestorOrThisOfType(summaryCaseCollection);
|
||||
summaryCase->firstAncestorOrThisOfType( summaryCaseCollection );
|
||||
|
||||
if (summaryCaseCollection)
|
||||
if ( summaryCaseCollection )
|
||||
{
|
||||
summaryCaseCollection->removeCase(summaryCase);
|
||||
summaryCaseDropTarget->addCase(summaryCase);
|
||||
summaryCaseCollection->removeCase( summaryCase );
|
||||
summaryCaseDropTarget->addCase( summaryCase );
|
||||
summaryCaseCollection->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
summaryCaseDropTarget->updateConnectedEditors();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuDragDrop::objectGroupFromModelIndexes(caf::PdmObjectGroup* objectGroup, const QModelIndexList& indexes)
|
||||
void RiuDragDrop::objectGroupFromModelIndexes( caf::PdmObjectGroup* objectGroup, const QModelIndexList& indexes )
|
||||
{
|
||||
CVF_ASSERT(objectGroup);
|
||||
CVF_ASSERT( objectGroup );
|
||||
|
||||
objectGroup->objects.clear();
|
||||
caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
|
||||
for (int i = 0; i < indexes.size(); i++)
|
||||
for ( int i = 0; i < indexes.size(); i++ )
|
||||
{
|
||||
caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex(indexes[i]);
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(uiItem);
|
||||
if (objHandle)
|
||||
caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex( indexes[i] );
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( uiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objectGroup->objects.push_back(objHandle);
|
||||
objectGroup->objects.push_back( objHandle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmPointer<caf::PdmObjectHandle> > RiuDragDrop::objectHandlesFromSelection()
|
||||
std::vector<caf::PdmPointer<caf::PdmObjectHandle>> RiuDragDrop::objectHandlesFromSelection()
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
std::vector<caf::PdmPointer<caf::PdmObjectHandle> > objectHandles;
|
||||
std::vector<caf::PdmPointer<caf::PdmObjectHandle>> objectHandles;
|
||||
|
||||
for (size_t sIdx = 0; sIdx < selection.size(); sIdx++)
|
||||
for ( size_t sIdx = 0; sIdx < selection.size(); sIdx++ )
|
||||
{
|
||||
objectHandles.push_back(selection[sIdx]);
|
||||
objectHandles.push_back( selection[sIdx] );
|
||||
}
|
||||
|
||||
return objectHandles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuDragDrop::onProposedDropActionUpdated(Qt::DropAction action)
|
||||
void RiuDragDrop::onProposedDropActionUpdated( Qt::DropAction action )
|
||||
{
|
||||
m_proposedDropAction = action;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user