Rename ApplicationCode to ApplicationLibCode

This commit is contained in:
Gaute Lindkvist committed 2021-01-11 15:27:45 +01:00
1 parent 751df1a421
commit 81699db187
3242 files changed

No files matched your search

@@ -0,0 +1,36 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.h
${CMAKE_CURRENT_LIST_DIR}/RicAppendIntersectionBoxFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxXSliceFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxYSliceFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxZSliceFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxAtPosFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAppendIntersectionBoxFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxXSliceFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxYSliceFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxZSliceFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxAtPosFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND COMMAND_CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
set (COMMAND_QT_MOC_HEADERS
${COMMAND_QT_MOC_HEADERS}
${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.h
)
source_group( "CommandFeature\\IntersectionBox" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
@@ -0,0 +1,96 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAppendIntersectionBoxFeature.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "Riu3DMainWindowTools.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAppendIntersectionBoxFeature::isCommandEnabled()
{
RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
if ( coll ) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionBoxFeature::onActionTriggered( bool isChecked )
{
RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
if ( coll )
{
RimBoxIntersection* intersectionBox = new RimBoxIntersection();
intersectionBox->setName( "Intersection Box" );
coll->appendIntersectionBoxAndUpdate( intersectionBox );
intersectionBox->setToDefaultSizeBox();
coll->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox );
RimGridView* rimView = nullptr;
coll->firstAncestorOrThisOfTypeAsserted( rimView );
rimView->showGridCells( false );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionBoxFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/IntersectionBox16x16.png" ) );
actionToSetup->setText( "New Intersection Box" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionCollection* RicAppendIntersectionBoxFeature::intersectionCollection()
{
RimIntersectionCollection* intersectionBoxColl = nullptr;
std::vector<caf::PdmObjectHandle*> selectedObjects;
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
if ( selectedObjects.size() == 1 )
{
selectedObjects[0]->firstAncestorOrThisOfType( intersectionBoxColl );
}
return intersectionBoxColl;
}
@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
//==================================================================================================
///
//==================================================================================================
class RicAppendIntersectionBoxFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static RimIntersectionCollection* intersectionCollection();
};
@@ -0,0 +1,175 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2013- Statoil ASA
// Copyright (C) 2013- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicBoxManipulatorEventHandler.h"
#include "cafBoxManipulatorPartManager.h"
#include "cafEffectGenerator.h"
#include "cafViewer.h"
#include "cvfCamera.h"
#include "cvfDrawableGeo.h"
#include "cvfHitItemCollection.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfRay.h"
#include "cvfRayIntersectSpec.h"
#include <QDebug>
#include <QMouseEvent>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicBoxManipulatorEventHandler::RicBoxManipulatorEventHandler( caf::Viewer* viewer )
: m_viewer( viewer )
{
m_partManager = new caf::BoxManipulatorPartManager;
m_viewer->installEventFilter( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicBoxManipulatorEventHandler::~RicBoxManipulatorEventHandler()
{
if ( m_viewer ) m_viewer->removeEventFilter( this );
for ( auto viewer : m_otherViewers )
{
if ( viewer )
{
m_viewer->removeEventFilter( this );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::registerInAdditionalViewer( caf::Viewer* viewer )
{
if ( viewer )
{
m_otherViewers.push_back( viewer );
viewer->installEventFilter( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::setOrigin( const cvf::Vec3d& origin )
{
m_partManager->setOrigin( origin );
emit notifyRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::setSize( const cvf::Vec3d& size )
{
m_partManager->setSize( size );
emit notifyRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::appendPartsToModel( cvf::ModelBasicList* model )
{
m_partManager->appendPartsToModel( model );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicBoxManipulatorEventHandler::eventFilter( QObject* obj, QEvent* inputEvent )
{
caf::Viewer* viewer = dynamic_cast<caf::Viewer*>( obj );
if ( !viewer ) return false;
if ( inputEvent->type() == QEvent::MouseButtonPress )
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
if ( mouseEvent->button() == Qt::LeftButton )
{
cvf::HitItemCollection hitItems;
if ( viewer->rayPick( mouseEvent->x(), mouseEvent->y(), &hitItems ) )
{
m_partManager->tryToActivateManipulator( hitItems.firstItem() );
if ( m_partManager->isManipulatorActive() )
{
emit notifyRedraw();
return true;
}
}
}
}
else if ( inputEvent->type() == QEvent::MouseMove )
{
if ( m_partManager->isManipulatorActive() )
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
cvf::ref<cvf::RayIntersectSpec> rayIS =
viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->pos().x(), mouseEvent->pos().y() );
if ( rayIS.notNull() )
{
m_partManager->updateManipulatorFromRay( rayIS->ray() );
cvf::Vec3d origin;
cvf::Vec3d size;
m_partManager->originAndSize( &origin, &size );
emit notifyUpdate( origin, size );
emit notifyRedraw();
return true;
}
}
}
else if ( inputEvent->type() == QEvent::MouseButtonRelease )
{
if ( m_partManager->isManipulatorActive() )
{
m_partManager->endManipulator();
cvf::Vec3d origin;
cvf::Vec3d size;
m_partManager->originAndSize( &origin, &size );
emit notifyUpdate( origin, size );
return true;
}
}
return false;
}
@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2013- Statoil ASA
// Copyright (C) 2013- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfMatrix4.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include <QObject>
#include <QPointer>
namespace cvf
{
class Model;
class ModelBasicList;
}; // namespace cvf
namespace caf
{
class BoxManipulatorPartManager;
class Viewer;
}; // namespace caf
class QMouseEvent;
//==================================================================================================
//
//
//==================================================================================================
class RicBoxManipulatorEventHandler : public QObject
{
Q_OBJECT
public:
explicit RicBoxManipulatorEventHandler( caf::Viewer* viewer );
~RicBoxManipulatorEventHandler() override;
void registerInAdditionalViewer( caf::Viewer* viewer );
void setOrigin( const cvf::Vec3d& origin );
void setSize( const cvf::Vec3d& size );
void appendPartsToModel( cvf::ModelBasicList* model );
signals:
void notifyRedraw();
void notifyUpdate( const cvf::Vec3d& origin, const cvf::Vec3d& size );
protected:
bool eventFilter( QObject* obj, QEvent* event ) override;
private:
QPointer<caf::Viewer> m_viewer;
std::vector<QPointer<caf::Viewer>> m_otherViewers;
cvf::ref<caf::BoxManipulatorPartManager> m_partManager;
};
@@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicIntersectionBoxAtPosFeature.h"
#include "RiaApplication.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicIntersectionBoxAtPosFeature, "RicIntersectionBoxAtPosFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxAtPosFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxAtPosFeature::onActionTriggered( bool isChecked )
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
RimGridView* activeMainOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( activeMainOrComparisonView )
{
RimIntersectionCollection* coll = activeMainOrComparisonView->intersectionCollection();
CVF_ASSERT( coll );
RimBoxIntersection* intersectionBox = new RimBoxIntersection();
intersectionBox->setName( "Intersection box" );
coll->appendIntersectionBoxAndUpdate( intersectionBox );
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice( RimBoxIntersection::PLANE_STATE_NONE, domainCoord );
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox, false );
activeMainOrComparisonView->showGridCells( false );
RiuMainWindow::instance()->refreshDrawStyleActions();
activeView->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxAtPosFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/IntersectionBox16x16.png" ) );
actionToSetup->setText( "Intersection Box" );
}
@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
//==================================================================================================
///
//==================================================================================================
class RicIntersectionBoxAtPosFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicIntersectionBoxXSliceFeature.h"
#include "RicIntersectionFeatureImpl.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RiuViewerCommands.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicIntersectionBoxXSliceFeature, "RicIntersectionBoxXSliceFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxXSliceFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxXSliceFeature::onActionTriggered( bool isChecked )
{
RicIntersectionFeatureImpl::createIntersectionBoxSlize( "X-slice (Intersection box)",
RimBoxIntersection::PLANE_STATE_X );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxXSliceFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/IntersectionXPlane16x16.png" ) );
actionToSetup->setText( "X-slice Intersection Box" );
}
@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
//==================================================================================================
///
//==================================================================================================
class RicIntersectionBoxXSliceFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicIntersectionBoxYSliceFeature.h"
#include "RicIntersectionFeatureImpl.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicIntersectionBoxYSliceFeature, "RicIntersectionBoxYSliceFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxYSliceFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxYSliceFeature::onActionTriggered( bool isChecked )
{
RicIntersectionFeatureImpl::createIntersectionBoxSlize( "Y-slice (Intersection box)",
RimBoxIntersection::PLANE_STATE_Y );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxYSliceFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/IntersectionYPlane16x16.png" ) );
actionToSetup->setText( "Y-slice Intersection Box" );
}
@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
//==================================================================================================
///
//==================================================================================================
class RicIntersectionBoxYSliceFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicIntersectionBoxZSliceFeature.h"
#include "RicIntersectionFeatureImpl.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RiuViewerCommands.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicIntersectionBoxZSliceFeature, "RicIntersectionBoxZSliceFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxZSliceFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxZSliceFeature::onActionTriggered( bool isChecked )
{
RicIntersectionFeatureImpl::createIntersectionBoxSlize( "Z-slice (Intersection box)",
RimBoxIntersection::PLANE_STATE_Z );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxZSliceFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/IntersectionZPlane16x16.png" ) );
actionToSetup->setText( "Z-slice Intersection Box" );
}
@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
//==================================================================================================
///
//==================================================================================================
class RicIntersectionBoxZSliceFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicIntersectionFeatureImpl.h"
#include "RiaApplication.h"
#include "RimBoxIntersection.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionFeatureImpl::createIntersectionBoxSlize( const QString& name, RimBoxIntersection::SinglePlaneState plane )
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
RimGridView* activeMainOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( activeMainOrComparisonView )
{
RimIntersectionCollection* coll = activeMainOrComparisonView->intersectionCollection();
CVF_ASSERT( coll );
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
RimBoxIntersection* intersectionBox = new RimBoxIntersection();
intersectionBox->setName( name );
coll->appendIntersectionBoxNoUpdate( intersectionBox );
intersectionBox->setToDefaultSizeSlice( plane, domainCoord );
coll->updateConnectedEditors();
activeMainOrComparisonView->showGridCells( false );
activeMainOrComparisonView->scheduleCreateDisplayModelAndRedraw();
activeView->scheduleCreateDisplayModelAndRedraw();
RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox, false );
RiuMainWindow::instance()->refreshDrawStyleActions();
}
}
@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimBoxIntersection.h"
class QString;
class RicIntersectionFeatureImpl
{
public:
static void createIntersectionBoxSlize( const QString& name, RimBoxIntersection::SinglePlaneState plane );
};