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:
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicPasteIntersectionsFeature, "RicPasteIntersectionsFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicPasteIntersectionsFeature, "RicPasteIntersectionsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -39,23 +39,23 @@ CAF_CMD_SOURCE_INIT(RicPasteIntersectionsFeature, "RicPasteIntersectionsFeature"
|
||||
bool RicPasteIntersectionsFeature::isCommandEnabled()
|
||||
{
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
|
||||
|
||||
std::vector<caf::PdmPointer<RimIntersection>> intersectionObjects;
|
||||
objectGroup.objectsByType(&intersectionObjects);
|
||||
objectGroup.objectsByType( &intersectionObjects );
|
||||
|
||||
std::vector<caf::PdmPointer<RimIntersectionBox>> intersectionBoxObjects;
|
||||
objectGroup.objectsByType(&intersectionBoxObjects);
|
||||
objectGroup.objectsByType( &intersectionBoxObjects );
|
||||
|
||||
if (intersectionObjects.empty() && intersectionBoxObjects.empty())
|
||||
if ( intersectionObjects.empty() && intersectionBoxObjects.empty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
caf::PdmObjectHandle* destinationObject =
|
||||
dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
|
||||
caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
if (findIntersectionCollection(destinationObject))
|
||||
if ( findIntersectionCollection( destinationObject ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -66,60 +66,61 @@ bool RicPasteIntersectionsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteIntersectionsFeature::onActionTriggered(bool isChecked)
|
||||
void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject =
|
||||
dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
|
||||
caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
RimIntersectionCollection* intersectionCollection =
|
||||
RicPasteIntersectionsFeature::findIntersectionCollection(destinationObject);
|
||||
RimIntersectionCollection* intersectionCollection = RicPasteIntersectionsFeature::findIntersectionCollection(
|
||||
destinationObject );
|
||||
|
||||
CAF_ASSERT(intersectionCollection);
|
||||
CAF_ASSERT( intersectionCollection );
|
||||
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
|
||||
|
||||
if (objectGroup.objects.size() == 0) return;
|
||||
if ( objectGroup.objects.size() == 0 ) return;
|
||||
|
||||
std::vector<caf::PdmPointer<RimIntersection>> intersectionObjects;
|
||||
objectGroup.objectsByType(&intersectionObjects);
|
||||
objectGroup.objectsByType( &intersectionObjects );
|
||||
|
||||
for (size_t i = 0; i < intersectionObjects.size(); i++)
|
||||
for ( size_t i = 0; i < intersectionObjects.size(); i++ )
|
||||
{
|
||||
RimIntersection* intersection = dynamic_cast<RimIntersection*>(
|
||||
intersectionObjects[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
intersectionObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
QString nameOfCopy = QString("Copy of ") + intersection->name;
|
||||
QString nameOfCopy = QString( "Copy of " ) + intersection->name;
|
||||
intersection->name = nameOfCopy;
|
||||
|
||||
if (i == intersectionObjects.size() - 1)
|
||||
if ( i == intersectionObjects.size() - 1 )
|
||||
{
|
||||
intersectionCollection->appendIntersectionAndUpdate(intersection);
|
||||
intersectionCollection->appendIntersectionAndUpdate( intersection );
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectionCollection->appendIntersectionNoUpdate(intersection);
|
||||
intersectionCollection->appendIntersectionNoUpdate( intersection );
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<caf::PdmPointer<RimIntersectionBox>> intersectionBoxObjects;
|
||||
objectGroup.objectsByType(&intersectionBoxObjects);
|
||||
objectGroup.objectsByType( &intersectionBoxObjects );
|
||||
|
||||
for (size_t i = 0; i < intersectionBoxObjects.size(); i++)
|
||||
for ( size_t i = 0; i < intersectionBoxObjects.size(); i++ )
|
||||
{
|
||||
RimIntersectionBox* intersectionBox = dynamic_cast<RimIntersectionBox*>(
|
||||
intersectionBoxObjects[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
intersectionBoxObjects[i]->xmlCapability()->copyByXmlSerialization(
|
||||
caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
QString nameOfCopy = QString("Copy of ") + intersectionBox->name;
|
||||
QString nameOfCopy = QString( "Copy of " ) + intersectionBox->name;
|
||||
intersectionBox->name = nameOfCopy;
|
||||
|
||||
if (i == intersectionBoxObjects.size() - 1)
|
||||
if ( i == intersectionBoxObjects.size() - 1 )
|
||||
{
|
||||
intersectionCollection->appendIntersectionBoxAndUpdate(intersectionBox);
|
||||
intersectionCollection->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectionCollection->appendIntersectionBoxNoUpdate(intersectionBox);
|
||||
intersectionCollection->appendIntersectionBoxNoUpdate( intersectionBox );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,35 +128,35 @@ void RicPasteIntersectionsFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteIntersectionsFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicPasteIntersectionsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText("Paste (Intersections)");
|
||||
actionToSetup->setText( "Paste (Intersections)" );
|
||||
|
||||
RicPasteFeatureImpl::setIconAndShortcuts(actionToSetup);
|
||||
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionCollection* RicPasteIntersectionsFeature::findIntersectionCollection(caf::PdmObjectHandle* objectHandle)
|
||||
RimIntersectionCollection* RicPasteIntersectionsFeature::findIntersectionCollection( caf::PdmObjectHandle* objectHandle )
|
||||
{
|
||||
RimIntersectionCollection* intersectionCollection = dynamic_cast<RimIntersectionCollection*>(objectHandle);
|
||||
if (intersectionCollection)
|
||||
RimIntersectionCollection* intersectionCollection = dynamic_cast<RimIntersectionCollection*>( objectHandle );
|
||||
if ( intersectionCollection )
|
||||
{
|
||||
return intersectionCollection;
|
||||
}
|
||||
|
||||
RimIntersection* intersection = dynamic_cast<RimIntersection*>(objectHandle);
|
||||
if (intersection)
|
||||
RimIntersection* intersection = dynamic_cast<RimIntersection*>( objectHandle );
|
||||
if ( intersection )
|
||||
{
|
||||
intersection->firstAncestorOrThisOfType(intersectionCollection);
|
||||
intersection->firstAncestorOrThisOfType( intersectionCollection );
|
||||
return intersectionCollection;
|
||||
}
|
||||
|
||||
RimIntersectionBox* intersectionBox = dynamic_cast<RimIntersectionBox*>(objectHandle);
|
||||
if (intersectionBox)
|
||||
RimIntersectionBox* intersectionBox = dynamic_cast<RimIntersectionBox*>( objectHandle );
|
||||
if ( intersectionBox )
|
||||
{
|
||||
intersectionBox->firstAncestorOrThisOfType(intersectionCollection);
|
||||
intersectionBox->firstAncestorOrThisOfType( intersectionCollection );
|
||||
return intersectionCollection;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user