#4857 RicIntersectionBox[XYZ]SliceFeature

This commit is contained in:
Jacob Støren 2019-10-18 10:17:50 +02:00
parent b785969d68
commit 4253c32dac
6 changed files with 174 additions and 78 deletions

View File

@ -1,5 +1,6 @@
set (SOURCE_GROUP_HEADER_FILES set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.h
${CMAKE_CURRENT_LIST_DIR}/RicAppendIntersectionBoxFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicAppendIntersectionBoxFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxXSliceFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxXSliceFeature.h
@ -9,6 +10,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxAtPosFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicBoxManipulatorEventHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAppendIntersectionBoxFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicAppendIntersectionBoxFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxXSliceFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicIntersectionBoxXSliceFeature.cpp

View File

@ -18,6 +18,8 @@
#include "RicIntersectionBoxXSliceFeature.h" #include "RicIntersectionBoxXSliceFeature.h"
#include "RicIntersectionFeatureImpl.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimCase.h" #include "RimCase.h"
@ -51,33 +53,32 @@ bool RicIntersectionBoxXSliceFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicIntersectionBoxXSliceFeature::onActionTriggered( bool isChecked ) void RicIntersectionBoxXSliceFeature::onActionTriggered( bool isChecked )
{ {
RimGridView* activeView = RiaApplication::instance()->activeGridView(); RicIntersectionFeatureImpl::createIntersectionBoxSlize("X-slice (Intersection box)", RimIntersectionBox::PLANE_STATE_X);
if ( activeView )
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT( coll );
RimIntersectionBox* intersectionBox = new RimIntersectionBox(); // RimGridView* activeView = RiaApplication::instance()->activeGridView();
intersectionBox->name = QString( "X-slice (Intersection box)" ); // RimGridView* activeMainOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
//
coll->appendIntersectionBoxAndUpdate( intersectionBox ); // if ( activeMainOrComparisonView )
// {
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords(); // RimIntersectionCollection* coll = activeMainOrComparisonView->crossSectionCollection();
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_X, domainCoord ); // CVF_ASSERT( coll );
//
coll->updateConnectedEditors(); // RimIntersectionBox* intersectionBox = new RimIntersectionBox();
RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox ); // intersectionBox->name = QString( "X-slice (Intersection box)" );
//
RimGridView* rimView = nullptr; // coll->appendIntersectionBoxAndUpdate( intersectionBox );
coll->firstAncestorOrThisOfType( rimView ); //
if ( rimView ) // cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
{ // intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_X, domainCoord );
rimView->showGridCells( false ); //
RiuMainWindow::instance()->refreshDrawStyleActions(); // coll->updateConnectedEditors();
// RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox, false );
rimView->scheduleCreateDisplayModelAndRedraw(); //
} // activeMainOrComparisonView->showGridCells(false);
} // RiuMainWindow::instance()->refreshDrawStyleActions();
//
// activeView->scheduleCreateDisplayModelAndRedraw();
// }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -18,6 +18,8 @@
#include "RicIntersectionBoxYSliceFeature.h" #include "RicIntersectionBoxYSliceFeature.h"
#include "RicIntersectionFeatureImpl.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimCase.h" #include "RimCase.h"
@ -51,33 +53,35 @@ bool RicIntersectionBoxYSliceFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicIntersectionBoxYSliceFeature::onActionTriggered( bool isChecked ) void RicIntersectionBoxYSliceFeature::onActionTriggered( bool isChecked )
{ {
RimGridView* activeView = RiaApplication::instance()->activeGridView(); RicIntersectionFeatureImpl::createIntersectionBoxSlize("Y-slice (Intersection box)", RimIntersectionBox::PLANE_STATE_Y);
if ( activeView )
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT( coll );
RimIntersectionBox* intersectionBox = new RimIntersectionBox(); //RimGridView* activeView = RiaApplication::instance()->activeGridView();
intersectionBox->name = QString( "Y-slice (Intersection box)" ); //if ( activeView )
//{
coll->appendIntersectionBoxAndUpdate( intersectionBox ); // RimIntersectionCollection* coll = activeView->crossSectionCollection();
// CVF_ASSERT( coll );
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords(); //
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_Y, domainCoord ); // RimIntersectionBox* intersectionBox = new RimIntersectionBox();
// intersectionBox->name = QString( "Y-slice (Intersection box)" );
coll->updateConnectedEditors(); //
RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox ); // coll->appendIntersectionBoxAndUpdate( intersectionBox );
//
RimGridView* rimView = nullptr; // cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
coll->firstAncestorOrThisOfType( rimView ); // intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_Y, domainCoord );
if ( rimView ) //
{ // coll->updateConnectedEditors();
rimView->showGridCells( false ); // RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox );
RiuMainWindow::instance()->refreshDrawStyleActions(); //
// RimGridView* rimView = nullptr;
rimView->scheduleCreateDisplayModelAndRedraw(); // coll->firstAncestorOrThisOfType( rimView );
} // if ( rimView )
} // {
// rimView->showGridCells( false );
// RiuMainWindow::instance()->refreshDrawStyleActions();
//
// rimView->scheduleCreateDisplayModelAndRedraw();
// }
//}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -18,6 +18,8 @@
#include "RicIntersectionBoxZSliceFeature.h" #include "RicIntersectionBoxZSliceFeature.h"
#include "RicIntersectionFeatureImpl.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimCase.h" #include "RimCase.h"
@ -51,33 +53,35 @@ bool RicIntersectionBoxZSliceFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicIntersectionBoxZSliceFeature::onActionTriggered( bool isChecked ) void RicIntersectionBoxZSliceFeature::onActionTriggered( bool isChecked )
{ {
RimGridView* activeView = RiaApplication::instance()->activeGridView(); RicIntersectionFeatureImpl::createIntersectionBoxSlize("Z-slice (Intersection box)", RimIntersectionBox::PLANE_STATE_Z);
if ( activeView )
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT( coll );
RimIntersectionBox* intersectionBox = new RimIntersectionBox(); // RimGridView* activeView = RiaApplication::instance()->activeGridView();
intersectionBox->name = QString( "Z-slice (Intersection box)" ); // if ( activeView )
// {
coll->appendIntersectionBoxAndUpdate( intersectionBox ); // RimIntersectionCollection* coll = activeView->crossSectionCollection();
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords(); // CVF_ASSERT( coll );
//
intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_Z, domainCoord ); // RimIntersectionBox* intersectionBox = new RimIntersectionBox();
// intersectionBox->name = QString( "Z-slice (Intersection box)" );
coll->updateConnectedEditors(); //
RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox ); // coll->appendIntersectionBoxAndUpdate( intersectionBox );
// cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
RimGridView* rimView = nullptr; //
coll->firstAncestorOrThisOfType( rimView ); // intersectionBox->setToDefaultSizeSlice( RimIntersectionBox::PLANE_STATE_Z, domainCoord );
if ( rimView ) //
{ // coll->updateConnectedEditors();
rimView->showGridCells( false ); // RiuMainWindow::instance()->selectAsCurrentItem( intersectionBox );
RiuMainWindow::instance()->refreshDrawStyleActions(); //
// RimGridView* rimView = nullptr;
rimView->scheduleCreateDisplayModelAndRedraw(); // coll->firstAncestorOrThisOfType( rimView );
} // if ( rimView )
} // {
// rimView->showGridCells( false );
// RiuMainWindow::instance()->refreshDrawStyleActions();
//
// rimView->scheduleCreateDisplayModelAndRedraw();
// }
// }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -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 "RimGridView.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionFeatureImpl::createIntersectionBoxSlize(const QString& name, RimIntersectionBox::SinglePlaneState plane)
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
RimGridView* activeMainOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( activeMainOrComparisonView )
{
RimIntersectionCollection* coll = activeMainOrComparisonView->crossSectionCollection();
CVF_ASSERT( coll );
cvf::Vec3d domainCoord = activeView->viewer()->viewerCommands()->lastPickPositionInDomainCoords();
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = 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();
}
}

View File

@ -0,0 +1,26 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimIntersectionBox.h"
class QString;
class RicIntersectionFeatureImpl
{
public :
static void createIntersectionBoxSlize(const QString& name, RimIntersectionBox::SinglePlaneState plane );
};