mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4857 Add support to distinguish 3D-view commands done in the main and comparison view
Support annotation and rangefilter creation in the comparison view
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfCamera.h"
|
||||
@@ -57,12 +58,14 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( activeView )
|
||||
{
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = activeView->ownerCase()->activeCellsBoundingBox();
|
||||
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = viewOrComparisonView->ownerCase()->activeCellsBoundingBox();
|
||||
|
||||
if ( contMapView ) domainCoord[2] = bbox.max().z() - bbox.extent().z() * 0.2;
|
||||
|
||||
auto coll = activeView->annotationCollection();
|
||||
auto coll = viewOrComparisonView->annotationCollection();
|
||||
|
||||
if ( coll )
|
||||
{
|
||||
@@ -70,7 +73,9 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered( bool isChecked )
|
||||
newAnnotation->setAnchorPoint( domainCoord );
|
||||
cvf::Vec3d labelPos = domainCoord;
|
||||
|
||||
if ( activeView->viewer()->mainCamera()->direction().z() <= 0 )
|
||||
cvf::Camera* viewCamera = activeView->viewer()->mainCamera();
|
||||
|
||||
if ( viewCamera->direction().z() <= 0 )
|
||||
{
|
||||
labelPos.z() = bbox.max().z();
|
||||
}
|
||||
@@ -79,10 +84,10 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered( bool isChecked )
|
||||
labelPos.z() = bbox.min().z();
|
||||
}
|
||||
|
||||
cvf::Vec3d horizontalRight = activeView->viewer()->mainCamera()->direction() ^ cvf::Vec3d::Z_AXIS;
|
||||
cvf::Vec3d horizontalUp = activeView->viewer()->mainCamera()->up() -
|
||||
( cvf::Vec3d::Z_AXIS *
|
||||
( activeView->viewer()->mainCamera()->up() * cvf::Vec3d::Z_AXIS ) );
|
||||
cvf::Vec3d horizontalRight = viewCamera->direction() ^ cvf::Vec3d::Z_AXIS;
|
||||
cvf::Vec3d horizontalUp = viewCamera->up() -
|
||||
( cvf::Vec3d::Z_AXIS * ( viewCamera->up() * cvf::Vec3d::Z_AXIS ) );
|
||||
|
||||
bool isOk = horizontalRight.normalize();
|
||||
if ( !isOk ) horizontalRight = {1.0, 0.0, 0.0};
|
||||
|
||||
@@ -93,7 +98,7 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered( bool isChecked )
|
||||
coll->scheduleRedrawOfRelevantViews();
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -61,7 +62,8 @@ void RicIntersectionBoxAtPosFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
coll->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
|
||||
|
||||
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_NONE, domainCoord );
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
@@ -61,7 +62,7 @@ void RicIntersectionBoxXSliceFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
coll->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
|
||||
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_X, domainCoord );
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -61,7 +62,7 @@ void RicIntersectionBoxYSliceFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
coll->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
|
||||
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_Y, domainCoord );
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
@@ -60,7 +61,8 @@ void RicIntersectionBoxZSliceFeature::onActionTriggered( bool isChecked )
|
||||
intersectionBox->name = QString( "Z-slice (Intersection box)" );
|
||||
|
||||
coll->appendIntersectionBoxAndUpdate( intersectionBox );
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
|
||||
|
||||
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_Z, domainCoord );
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
@@ -26,23 +26,28 @@
|
||||
#include "RimGridView.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewSliceRangeFilterFeature, "RicNewSliceRangeFilterFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicNewSliceRangeFilter3dViewFeature, "RicNewSliceRangeFilter3dViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSliceRangeFilterFeature::isCommandEnabled()
|
||||
bool RicNewSliceRangeFilter3dViewFeature::isCommandEnabled()
|
||||
{
|
||||
RimGridView* view = RiaApplication::instance()->activeGridView();
|
||||
if ( !view ) return false;
|
||||
|
||||
RimViewController* vc = view->viewController();
|
||||
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
|
||||
RimViewController* vc = viewOrComparisonView->viewController();
|
||||
if ( !vc ) return true;
|
||||
|
||||
return ( !vc->isRangeFiltersControlled() );
|
||||
@@ -51,14 +56,16 @@ bool RicNewSliceRangeFilterFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSliceRangeFilterFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewSliceRangeFilter3dViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QVariant userData = this->userData();
|
||||
|
||||
if ( !userData.isNull() && userData.type() == QVariant::List )
|
||||
{
|
||||
RimGridView* view = RiaApplication::instance()->activeGridView();
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = view->rangeFilterCollection();
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = viewOrComparisonView->rangeFilterCollection();
|
||||
|
||||
RicRangeFilterNewExec* filterExec = new RicRangeFilterNewExec( rangeFilterCollection );
|
||||
|
||||
@@ -87,14 +94,14 @@ void RicNewSliceRangeFilterFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
view->setSurfaceDrawstyle();
|
||||
activeView->setSurfaceDrawstyle();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSliceRangeFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewSliceRangeFilter3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Range.png" ) );
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewSliceRangeFilterFeature : public caf::CmdFeature
|
||||
class RicNewSliceRangeFilter3dViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void RicRangeFilterNewExec::redo()
|
||||
|
||||
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( rangeFilter );
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( rangeFilter, false );
|
||||
|
||||
// Trigger update of view following the range filter update
|
||||
RimGridView* view = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user