#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 deletions

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -32,10 +32,10 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicAppendIntersectionFeature, "RicAppendIntersectionFeature");
CAF_CMD_SOURCE_INIT( RicAppendIntersectionFeature, "RicAppendIntersectionFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicAppendIntersectionFeature::isCommandEnabled()
{
@@ -43,50 +43,48 @@ bool RicAppendIntersectionFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeature::onActionTriggered(bool isChecked)
void RicAppendIntersectionFeature::onActionTriggered( bool isChecked )
{
std::vector<caf::PdmObjectHandle*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
caf::SelectionManager::instance()->objectsByType( &collection );
CVF_ASSERT( collection.size() == 1 );
RimIntersectionCollection* intersectionCollection = nullptr;
collection[0]->firstAncestorOrThisOfType(intersectionCollection);
collection[0]->firstAncestorOrThisOfType( intersectionCollection );
CVF_ASSERT(intersectionCollection);
CVF_ASSERT( intersectionCollection );
RicAppendIntersectionFeatureCmd* cmd = new RicAppendIntersectionFeatureCmd(intersectionCollection);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
RicAppendIntersectionFeatureCmd* cmd = new RicAppendIntersectionFeatureCmd( intersectionCollection );
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeature::setupActionLook(QAction* actionToSetup)
void RicAppendIntersectionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
actionToSetup->setText( "New Intersection" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicAppendIntersectionFeatureCmd::RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection)
: CmdExecuteCommand(nullptr),
m_intersectionCollection(intersectionCollection)
RicAppendIntersectionFeatureCmd::RicAppendIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection )
: CmdExecuteCommand( nullptr )
, m_intersectionCollection( intersectionCollection )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicAppendIntersectionFeatureCmd::~RicAppendIntersectionFeatureCmd()
{
}
RicAppendIntersectionFeatureCmd::~RicAppendIntersectionFeatureCmd() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicAppendIntersectionFeatureCmd::name()
{
@@ -94,30 +92,28 @@ QString RicAppendIntersectionFeatureCmd::name()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT( m_intersectionCollection );
RimIntersection* intersection = new RimIntersection();
intersection->name = QString("Intersection");
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
intersection->name = QString( "Intersection" );
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
RimGridView* view = nullptr;
m_intersectionCollection->firstAncestorOrThisOfTypeAsserted(view);
m_intersectionCollection->firstAncestorOrThisOfTypeAsserted( view );
RimGeoMechView* geoMechView = nullptr;
geoMechView = dynamic_cast<RimGeoMechView*>(view);
if (geoMechView)
geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( geoMechView )
{
geoMechView->tensorResults()->setShowTensors(false);
geoMechView->tensorResults()->setShowTensors( false );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeatureCmd::undo()
{
}
void RicAppendIntersectionFeatureCmd::undo() {}

View File

@@ -2,51 +2,48 @@
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
//==================================================================================================
///
///
//==================================================================================================
class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
explicit RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
explicit RicAppendIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection );
~RicAppendIntersectionFeatureCmd() override;
QString name() override;
void redo() override;
void undo() override;
void redo() override;
void undo() override;
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
};
//==================================================================================================
///
///
//==================================================================================================
class RicAppendIntersectionFeature : public caf::CmdFeature
{
@@ -58,5 +55,3 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -2,56 +2,60 @@
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicCopyIntersectionsToAllViewsInCaseFeature.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimGridView.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RimGridView.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimEclipseCase.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManagerTools.h"
#include "cafPdmUiItem.h"
#include "cafSelectionManagerTools.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCopyIntersectionsToAllViewsInCaseFeature, "RicCopyIntersectionsToAllViewsInCaseFeature");
CAF_CMD_SOURCE_INIT( RicCopyIntersectionsToAllViewsInCaseFeature, "RicCopyIntersectionsToAllViewsInCaseFeature" );
//--------------------------------------------------------------------------------------------------
/// Internal definitions
//--------------------------------------------------------------------------------------------------
enum SelectionComposition {SEL_INVALID, SEL_COLLECTION, SEL_INTERSECTIONS, SEL_INTERSECTION_BOXES, SEL_BOTH_INTERSECTION_TYPES };
static RimIntersectionCollection* selectedIntersectionCollection();
static std::vector<RimIntersection*> selectedIntersections();
static std::vector<RimIntersectionBox*> selectedIntersectionBoxes();
static SelectionComposition selectionComposition();
static RimCase* commonGridCase(std::vector<caf::PdmUiItem*> selectedItems);
enum SelectionComposition
{
SEL_INVALID,
SEL_COLLECTION,
SEL_INTERSECTIONS,
SEL_INTERSECTION_BOXES,
SEL_BOTH_INTERSECTION_TYPES
};
static RimIntersectionCollection* selectedIntersectionCollection();
static std::vector<RimIntersection*> selectedIntersections();
static std::vector<RimIntersectionBox*> selectedIntersectionBoxes();
static SelectionComposition selectionComposition();
static RimCase* commonGridCase( std::vector<caf::PdmUiItem*> selectedItems );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicCopyIntersectionsToAllViewsInCaseFeature::isCommandEnabled()
{
@@ -59,70 +63,72 @@ bool RicCopyIntersectionsToAllViewsInCaseFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCopyIntersectionsToAllViewsInCaseFeature::onActionTriggered(bool isChecked)
void RicCopyIntersectionsToAllViewsInCaseFeature::onActionTriggered( bool isChecked )
{
RimCase* gridCase = nullptr;
RimCase* gridCase = nullptr;
std::vector<caf::PdmUiItem*> selItems;
caf::SelectionManager::instance()->selectedItems(selItems);
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selItems.front());
if (objHandle) objHandle->firstAncestorOrThisOfType(gridCase);
caf::SelectionManager::instance()->selectedItems( selItems );
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( selItems.front() );
if ( objHandle ) objHandle->firstAncestorOrThisOfType( gridCase );
if (gridCase)
if ( gridCase )
{
SelectionComposition compostion = selectionComposition();
if (compostion == SEL_COLLECTION)
if ( compostion == SEL_COLLECTION )
{
RimIntersectionCollection* coll = selectedIntersectionCollection();
copyIntersectionsToOtherViews(*gridCase, coll->intersections());
copyIntersectionBoxesToOtherViews(*gridCase, coll->intersectionBoxes());
copyIntersectionsToOtherViews( *gridCase, coll->intersections() );
copyIntersectionBoxesToOtherViews( *gridCase, coll->intersectionBoxes() );
}
std::vector<RimIntersection*> selIntersections = selectedIntersections();
std::vector<RimIntersection*> selIntersections = selectedIntersections();
std::vector<RimIntersectionBox*> selIntersectionBoxes = selectedIntersectionBoxes();
if (compostion == SEL_INTERSECTIONS || compostion == SEL_BOTH_INTERSECTION_TYPES)
if ( compostion == SEL_INTERSECTIONS || compostion == SEL_BOTH_INTERSECTION_TYPES )
{
copyIntersectionsToOtherViews(*gridCase, selIntersections);
copyIntersectionsToOtherViews( *gridCase, selIntersections );
}
if (compostion == SEL_INTERSECTION_BOXES || compostion == SEL_BOTH_INTERSECTION_TYPES)
if ( compostion == SEL_INTERSECTION_BOXES || compostion == SEL_BOTH_INTERSECTION_TYPES )
{
copyIntersectionBoxesToOtherViews(*gridCase, selIntersectionBoxes);
copyIntersectionBoxesToOtherViews( *gridCase, selIntersectionBoxes );
}
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCopyIntersectionsToAllViewsInCaseFeature::setupActionLook(QAction* actionToSetup)
void RicCopyIntersectionsToAllViewsInCaseFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon(QIcon(":/Copy.png"));
actionToSetup->setText("Copy intersections to all views in case");
actionToSetup->setIcon( QIcon( ":/Copy.png" ) );
actionToSetup->setText( "Copy intersections to all views in case" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionsToOtherViews(RimCase& gridCase, std::vector<RimIntersection*> intersections)
void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionsToOtherViews(
RimCase& gridCase, std::vector<RimIntersection*> intersections )
{
for (RimIntersection* intersection : intersections)
for ( RimIntersection* intersection : intersections )
{
for (Rim3dView* const view : gridCase.views())
for ( Rim3dView* const view : gridCase.views() )
{
RimGridView* currGridView = dynamic_cast<RimGridView*>(view);
RimGridView* parentView = nullptr;
intersection->firstAncestorOrThisOfType(parentView);
RimGridView* currGridView = dynamic_cast<RimGridView*>( view );
RimGridView* parentView = nullptr;
intersection->firstAncestorOrThisOfType( parentView );
if (currGridView && parentView != nullptr && parentView != currGridView)
if ( currGridView && parentView != nullptr && parentView != currGridView )
{
RimIntersectionCollection* destCollection = currGridView->crossSectionCollection();
RimIntersection* copy = dynamic_cast<RimIntersection*>(intersection->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
CVF_ASSERT(copy);
RimIntersection* copy = dynamic_cast<RimIntersection*>(
intersection->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( copy );
destCollection->appendIntersectionAndUpdate(copy);
destCollection->appendIntersectionAndUpdate( copy );
// Resolve references after object has been inserted into the project data model
copy->resolveReferencesRecursively();
@@ -133,33 +139,35 @@ void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionsToOtherViews(
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionBoxesToOtherViews(RimCase& gridCase, std::vector<RimIntersectionBox*> intersectionBoxes)
void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionBoxesToOtherViews(
RimCase& gridCase, std::vector<RimIntersectionBox*> intersectionBoxes )
{
for (RimIntersectionBox* intersectionBox : intersectionBoxes)
for ( RimIntersectionBox* intersectionBox : intersectionBoxes )
{
for (Rim3dView* const view : gridCase.views())
for ( Rim3dView* const view : gridCase.views() )
{
RimGridView* currGridView = dynamic_cast<RimGridView*>(view);
RimGridView* parentView = nullptr;
intersectionBox->firstAncestorOrThisOfType(parentView);
RimGridView* currGridView = dynamic_cast<RimGridView*>( view );
RimGridView* parentView = nullptr;
intersectionBox->firstAncestorOrThisOfType( parentView );
if (currGridView && parentView != nullptr && parentView != currGridView)
if ( currGridView && parentView != nullptr && parentView != currGridView )
{
RimIntersectionCollection* destCollection = currGridView->crossSectionCollection();
RimIntersectionBox* copy = dynamic_cast<RimIntersectionBox*>(intersectionBox->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
CVF_ASSERT(copy);
RimIntersectionBox* copy = dynamic_cast<RimIntersectionBox*>(
intersectionBox->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( copy );
destCollection->appendIntersectionBoxAndUpdate(copy);
destCollection->appendIntersectionBoxAndUpdate( copy );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimIntersectionCollection* selectedIntersectionCollection()
{
@@ -168,7 +176,7 @@ RimIntersectionCollection* selectedIntersectionCollection()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::vector<RimIntersection*> selectedIntersections()
{
@@ -176,7 +184,7 @@ std::vector<RimIntersection*> selectedIntersections()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::vector<RimIntersectionBox*> selectedIntersectionBoxes()
{
@@ -184,54 +192,59 @@ std::vector<RimIntersectionBox*> selectedIntersectionBoxes()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
SelectionComposition selectionComposition()
{
std::vector<caf::PdmUiItem*> allSelectedObjects;
caf::SelectionManager::instance()->selectedItems(allSelectedObjects);
caf::SelectionManager::instance()->selectedItems( allSelectedObjects );
RimCase* gridCase = commonGridCase(allSelectedObjects);
if (gridCase && gridCase->gridViews().size() > 1)
RimCase* gridCase = commonGridCase( allSelectedObjects );
if ( gridCase && gridCase->gridViews().size() > 1 )
{
RimIntersectionCollection* selColl = selectedIntersectionCollection();
std::vector<RimIntersection*> selIntersections = selectedIntersections();
RimIntersectionCollection* selColl = selectedIntersectionCollection();
std::vector<RimIntersection*> selIntersections = selectedIntersections();
std::vector<RimIntersectionBox*> selIntersectionBoxes = selectedIntersectionBoxes();
if (selColl)
if ( selColl )
{
if (allSelectedObjects.size() == 1) return SEL_COLLECTION;
if ( allSelectedObjects.size() == 1 ) return SEL_COLLECTION;
}
else
{
if (!selIntersections.empty() && !selIntersectionBoxes.empty()) return SEL_BOTH_INTERSECTION_TYPES;
else if (!selIntersections.empty()) return SEL_INTERSECTIONS;
else if (!selIntersectionBoxes.empty()) return SEL_INTERSECTION_BOXES;
if ( !selIntersections.empty() && !selIntersectionBoxes.empty() )
return SEL_BOTH_INTERSECTION_TYPES;
else if ( !selIntersections.empty() )
return SEL_INTERSECTIONS;
else if ( !selIntersectionBoxes.empty() )
return SEL_INTERSECTION_BOXES;
}
}
return SEL_INVALID;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimCase* commonGridCase(std::vector<caf::PdmUiItem*> selectedItems)
RimCase* commonGridCase( std::vector<caf::PdmUiItem*> selectedItems )
{
RimCase* gridCase = nullptr;
for (caf::PdmUiItem* item : selectedItems)
for ( caf::PdmUiItem* item : selectedItems )
{
caf::PdmObjectHandle* obj = dynamic_cast<caf::PdmObjectHandle*>(item);
if (!obj)
caf::PdmObjectHandle* obj = dynamic_cast<caf::PdmObjectHandle*>( item );
if ( !obj )
{
continue;
}
RimCase* itemCase = nullptr;
obj->firstAncestorOrThisOfType(itemCase);
obj->firstAncestorOrThisOfType( itemCase );
if (gridCase == nullptr) gridCase = itemCase;
else if (gridCase != itemCase) return nullptr;
if ( gridCase == nullptr )
gridCase = itemCase;
else if ( gridCase != itemCase )
return nullptr;
}
return gridCase;
}

View File

@@ -2,25 +2,25 @@
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
class RimCase;
@@ -28,9 +28,8 @@ class RimIntersection;
class RimIntersectionBox;
class RimIntersectionCollection;
//==================================================================================================
///
///
//==================================================================================================
class RicCopyIntersectionsToAllViewsInCaseFeature : public caf::CmdFeature
{
@@ -42,8 +41,6 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
void copyIntersectionsToOtherViews(RimCase& gridCase, std::vector<RimIntersection*> intersections);
void copyIntersectionBoxesToOtherViews(RimCase& gridCase, std::vector<RimIntersectionBox*> intersectionBoxes);
void copyIntersectionsToOtherViews( RimCase& gridCase, std::vector<RimIntersection*> intersections );
void copyIntersectionBoxesToOtherViews( RimCase& gridCase, std::vector<RimIntersectionBox*> intersectionBoxes );
};

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -21,9 +21,9 @@
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimGridView.h"
#include "Riu3DMainWindowTools.h"
#include "Riu3dSelectionManager.h"
@@ -38,18 +38,15 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewAzimuthDipIntersectionFeature, "RicNewAzimuthDipIntersectionFeature");
CAF_CMD_SOURCE_INIT( RicNewAzimuthDipIntersectionFeature, "RicNewAzimuthDipIntersectionFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewAzimuthDipIntersectionFeature::RicNewAzimuthDipIntersectionFeature()
{
}
RicNewAzimuthDipIntersectionFeature::RicNewAzimuthDipIntersectionFeature() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewAzimuthDipIntersectionFeature::isCommandEnabled()
{
@@ -57,44 +54,44 @@ bool RicNewAzimuthDipIntersectionFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewAzimuthDipIntersectionFeature::onActionTriggered(bool isChecked)
void RicNewAzimuthDipIntersectionFeature::onActionTriggered( bool isChecked )
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
if (!activeView) return;
RicNewAzimuthDipIntersectionFeatureCmd* cmd = new RicNewAzimuthDipIntersectionFeatureCmd(activeView->crossSectionCollection());
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
if ( !activeView ) return;
RicNewAzimuthDipIntersectionFeatureCmd* cmd = new RicNewAzimuthDipIntersectionFeatureCmd(
activeView->crossSectionCollection() );
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewAzimuthDipIntersectionFeature::setupActionLook(QAction* actionToSetup)
void RicNewAzimuthDipIntersectionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("Azimuth and Dip Intersection");
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
actionToSetup->setText( "Azimuth and Dip Intersection" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewAzimuthDipIntersectionFeatureCmd::RicNewAzimuthDipIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection)
: CmdExecuteCommand(nullptr),
m_intersectionCollection(intersectionCollection)
RicNewAzimuthDipIntersectionFeatureCmd::RicNewAzimuthDipIntersectionFeatureCmd(
RimIntersectionCollection* intersectionCollection )
: CmdExecuteCommand( nullptr )
, m_intersectionCollection( intersectionCollection )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewAzimuthDipIntersectionFeatureCmd::~RicNewAzimuthDipIntersectionFeatureCmd()
{
}
RicNewAzimuthDipIntersectionFeatureCmd::~RicNewAzimuthDipIntersectionFeatureCmd() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicNewAzimuthDipIntersectionFeatureCmd::name()
{
@@ -102,35 +99,33 @@ QString RicNewAzimuthDipIntersectionFeatureCmd::name()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewAzimuthDipIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT( m_intersectionCollection );
RimIntersection* intersection = new RimIntersection();
intersection->name = "Azimuth and Dip";
intersection->type = RimIntersection::CS_AZIMUTHLINE;
RimIntersection* intersection = new RimIntersection();
intersection->name = "Azimuth and Dip";
intersection->type = RimIntersection::CS_AZIMUTHLINE;
intersection->inputTwoAzimuthPointsFromViewerEnabled = true;
RimCase* rimCase;
m_intersectionCollection->firstAncestorOrThisOfTypeAsserted(rimCase);
m_intersectionCollection->firstAncestorOrThisOfTypeAsserted( rimCase );
cvf::BoundingBox bBox = rimCase->allCellsBoundingBox();
if (bBox.isValid())
if ( bBox.isValid() )
{
intersection->setLengthUp(cvf::Math::floor(bBox.extent()[2] / 2));
intersection->setLengthDown(cvf::Math::floor(bBox.extent()[2] / 2));
intersection->setLengthUp( cvf::Math::floor( bBox.extent()[2] / 2 ) );
intersection->setLengthDown( cvf::Math::floor( bBox.extent()[2] / 2 ) );
}
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
Riu3dSelectionManager::instance()->deleteAllItems();
Riu3DMainWindowTools::selectAsCurrentItem(intersection);
Riu3DMainWindowTools::selectAsCurrentItem( intersection );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewAzimuthDipIntersectionFeatureCmd::undo()
{
}
void RicNewAzimuthDipIntersectionFeatureCmd::undo() {}

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -24,28 +24,25 @@
class RimIntersectionCollection;
//==================================================================================================
///
///
//==================================================================================================
class RicNewAzimuthDipIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
explicit RicNewAzimuthDipIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
explicit RicNewAzimuthDipIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection );
~RicNewAzimuthDipIntersectionFeatureCmd() override;
QString name() override;
void redo() override;
void undo() override;
void redo() override;
void undo() override;
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
};
//==================================================================================================
///
///
//==================================================================================================
class RicNewAzimuthDipIntersectionFeature : public caf::CmdFeature
{
@@ -59,5 +56,3 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -22,9 +22,9 @@
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimGridView.h"
#include "Riu3DMainWindowTools.h"
#include "Riu3dSelectionManager.h"
@@ -37,18 +37,15 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewPolylineIntersectionFeature, "RicNewPolylineIntersectionFeature");
CAF_CMD_SOURCE_INIT( RicNewPolylineIntersectionFeature, "RicNewPolylineIntersectionFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineIntersectionFeature::RicNewPolylineIntersectionFeature()
{
}
RicNewPolylineIntersectionFeature::RicNewPolylineIntersectionFeature() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewPolylineIntersectionFeature::isCommandEnabled()
{
@@ -56,44 +53,43 @@ bool RicNewPolylineIntersectionFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeature::onActionTriggered(bool isChecked)
void RicNewPolylineIntersectionFeature::onActionTriggered( bool isChecked )
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
if (!activeView) return;
RicNewPolylineIntersectionFeatureCmd* cmd = new RicNewPolylineIntersectionFeatureCmd(activeView->crossSectionCollection());
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
if ( !activeView ) return;
RicNewPolylineIntersectionFeatureCmd* cmd = new RicNewPolylineIntersectionFeatureCmd(
activeView->crossSectionCollection() );
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeature::setupActionLook(QAction* actionToSetup)
void RicNewPolylineIntersectionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("Polyline Intersection");
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
actionToSetup->setText( "Polyline Intersection" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineIntersectionFeatureCmd::RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection)
: CmdExecuteCommand(nullptr),
m_intersectionCollection(intersectionCollection)
RicNewPolylineIntersectionFeatureCmd::RicNewPolylineIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection )
: CmdExecuteCommand( nullptr )
, m_intersectionCollection( intersectionCollection )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineIntersectionFeatureCmd::~RicNewPolylineIntersectionFeatureCmd()
{
}
RicNewPolylineIntersectionFeatureCmd::~RicNewPolylineIntersectionFeatureCmd() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicNewPolylineIntersectionFeatureCmd::name()
{
@@ -101,27 +97,25 @@ QString RicNewPolylineIntersectionFeatureCmd::name()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT( m_intersectionCollection );
RimIntersection* intersection = new RimIntersection();
intersection->name = "Polyline";
intersection->type = RimIntersection::CS_POLYLINE;
RimIntersection* intersection = new RimIntersection();
intersection->name = "Polyline";
intersection->type = RimIntersection::CS_POLYLINE;
intersection->inputPolyLineFromViewerEnabled = true;
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
Riu3dSelectionManager::instance()->deleteAllItems();
Riu3DMainWindowTools::selectAsCurrentItem(intersection);
Riu3DMainWindowTools::selectAsCurrentItem( intersection );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeatureCmd::undo()
{
}
void RicNewPolylineIntersectionFeatureCmd::undo() {}

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -25,28 +25,25 @@
class RimIntersectionCollection;
//==================================================================================================
///
///
//==================================================================================================
class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
explicit RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
explicit RicNewPolylineIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection );
~RicNewPolylineIntersectionFeatureCmd() override;
QString name() override;
void redo() override;
void undo() override;
void redo() override;
void undo() override;
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
};
//==================================================================================================
///
///
//==================================================================================================
class RicNewPolylineIntersectionFeature : public caf::CmdFeature
{
@@ -60,5 +57,3 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -31,10 +31,10 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewSimWellIntersectionFeature, "RicNewSimWellIntersectionFeature");
CAF_CMD_SOURCE_INIT( RicNewSimWellIntersectionFeature, "RicNewSimWellIntersectionFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewSimWellIntersectionFeature::isCommandEnabled()
{
@@ -42,52 +42,51 @@ bool RicNewSimWellIntersectionFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionFeature::onActionTriggered(bool isChecked)
void RicNewSimWellIntersectionFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSimWellInView*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
caf::SelectionManager::instance()->objectsByType( &collection );
CVF_ASSERT( collection.size() == 1 );
RimSimWellInView* simWell = collection[0];
RimEclipseView* eclView = nullptr;
simWell->firstAncestorOrThisOfType(eclView);
CVF_ASSERT(eclView);
simWell->firstAncestorOrThisOfType( eclView );
CVF_ASSERT( eclView );
RicNewSimWellIntersectionCmd* cmd = new RicNewSimWellIntersectionCmd(eclView->crossSectionCollection(), simWell);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
RicNewSimWellIntersectionCmd* cmd = new RicNewSimWellIntersectionCmd( eclView->crossSectionCollection(), simWell );
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionFeature::setupActionLook(QAction* actionToSetup)
void RicNewSimWellIntersectionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
actionToSetup->setText( "New Intersection" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimSimWellInView* simWell)
: CmdExecuteCommand(nullptr),
m_intersectionCollection(intersectionCollection),
m_simWell(simWell)
RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd( RimIntersectionCollection* intersectionCollection,
RimSimWellInView* simWell )
: CmdExecuteCommand( nullptr )
, m_intersectionCollection( intersectionCollection )
, m_simWell( simWell )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewSimWellIntersectionCmd::~RicNewSimWellIntersectionCmd()
{
}
RicNewSimWellIntersectionCmd::~RicNewSimWellIntersectionCmd() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicNewSimWellIntersectionCmd::name()
{
@@ -95,24 +94,22 @@ QString RicNewSimWellIntersectionCmd::name()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT(m_simWell);
CVF_ASSERT( m_intersectionCollection );
CVF_ASSERT( m_simWell );
RimIntersection* intersection = new RimIntersection();
intersection->name = m_simWell->name;
intersection->type = RimIntersection::CS_SIMULATION_WELL;
intersection->simulationWell = m_simWell;
intersection->name = m_simWell->name;
intersection->type = RimIntersection::CS_SIMULATION_WELL;
intersection->simulationWell = m_simWell;
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionCmd::undo()
{
}
void RicNewSimWellIntersectionCmd::undo() {}

View File

@@ -2,53 +2,50 @@
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
class RimSimWellInView;
//==================================================================================================
///
///
//==================================================================================================
class RicNewSimWellIntersectionCmd : public caf::CmdExecuteCommand
{
public:
RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimSimWellInView* simWell);
RicNewSimWellIntersectionCmd( RimIntersectionCollection* intersectionCollection, RimSimWellInView* simWell );
~RicNewSimWellIntersectionCmd() override;
QString name() override;
void redo() override;
void undo() override;
void redo() override;
void undo() override;
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
caf::PdmPointer<RimSimWellInView> m_simWell;
caf::PdmPointer<RimSimWellInView> m_simWell;
};
//==================================================================================================
///
///
//==================================================================================================
class RicNewSimWellIntersectionFeature : public caf::CmdFeature
{
@@ -60,5 +57,3 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -21,10 +21,10 @@
#include "RiaApplication.h"
#include "RimGridView.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimWellPath.h"
#include "RimGridView.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
@@ -33,18 +33,15 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewWellPathIntersectionFeature, "RicNewWellPathIntersectionFeature");
CAF_CMD_SOURCE_INIT( RicNewWellPathIntersectionFeature, "RicNewWellPathIntersectionFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathIntersectionFeature::RicNewWellPathIntersectionFeature()
{
}
RicNewWellPathIntersectionFeature::RicNewWellPathIntersectionFeature() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathIntersectionFeature::isCommandEnabled()
{
@@ -52,51 +49,51 @@ bool RicNewWellPathIntersectionFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeature::onActionTriggered(bool isChecked)
void RicNewWellPathIntersectionFeature::onActionTriggered( bool isChecked )
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
if (!activeView) return;
if ( !activeView ) return;
std::vector<RimWellPath*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
caf::SelectionManager::instance()->objectsByType( &collection );
CVF_ASSERT( collection.size() == 1 );
RimWellPath* wellPath = collection[0];
RicNewWellPathIntersectionFeatureCmd* cmd = new RicNewWellPathIntersectionFeatureCmd(activeView->crossSectionCollection(), wellPath);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
RicNewWellPathIntersectionFeatureCmd* cmd =
new RicNewWellPathIntersectionFeatureCmd( activeView->crossSectionCollection(), wellPath );
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeature::setupActionLook(QAction* actionToSetup)
void RicNewWellPathIntersectionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("Create Intersection");
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
actionToSetup->setText( "Create Intersection" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathIntersectionFeatureCmd::RicNewWellPathIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection, RimWellPath* wellPath)
: CmdExecuteCommand(nullptr),
m_intersectionCollection(intersectionCollection),
m_wellPath(wellPath)
RicNewWellPathIntersectionFeatureCmd::RicNewWellPathIntersectionFeatureCmd(
RimIntersectionCollection* intersectionCollection, RimWellPath* wellPath )
: CmdExecuteCommand( nullptr )
, m_intersectionCollection( intersectionCollection )
, m_wellPath( wellPath )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathIntersectionFeatureCmd::~RicNewWellPathIntersectionFeatureCmd()
{
}
RicNewWellPathIntersectionFeatureCmd::~RicNewWellPathIntersectionFeatureCmd() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicNewWellPathIntersectionFeatureCmd::name()
{
@@ -104,24 +101,22 @@ QString RicNewWellPathIntersectionFeatureCmd::name()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT(m_wellPath);
CVF_ASSERT( m_intersectionCollection );
CVF_ASSERT( m_wellPath );
RimIntersection* intersection = new RimIntersection();
intersection->name = m_wellPath->name();
intersection->type = RimIntersection::CS_WELL_PATH;
intersection->wellPath = m_wellPath;
intersection->name = m_wellPath->name();
intersection->type = RimIntersection::CS_WELL_PATH;
intersection->wellPath = m_wellPath;
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeatureCmd::undo()
{
}
void RicNewWellPathIntersectionFeatureCmd::undo() {}

View File

@@ -2,53 +2,50 @@
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
class RimWellPath;
//==================================================================================================
///
///
//==================================================================================================
class RicNewWellPathIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicNewWellPathIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection, RimWellPath* wellPath);
RicNewWellPathIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection, RimWellPath* wellPath );
~RicNewWellPathIntersectionFeatureCmd() override;
QString name() override;
void redo() override;
void undo() override;
void redo() override;
void undo() override;
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
caf::PdmPointer<RimWellPath> m_wellPath;
caf::PdmPointer<RimWellPath> m_wellPath;
};
//==================================================================================================
///
///
//==================================================================================================
class RicNewWellPathIntersectionFeature : public caf::CmdFeature
{
@@ -63,5 +60,3 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};