mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
Rewrite of cell filters. Added new polyline filter and user defined filter types. (#7191)
Make 3d view picker more generic to enable picking cell filter polygon Give cell filters a new, generic interface for updating included/excluded cells from collection Remove old range filter collection and replace with new filter collection that supports both range filters, polyline filters and user defined filters. Update existing range filter code for the new collection and interface Add user defined cell filter type Add polyline cell filter type Implement both Z and K index depth for polyline filters Allow interactive editing of polyline filter node positions. Support both geomech and eclipse views Support view linking with both eclipse and geomech views and the new filter types Support loading old project files with range filter collections into the new collection type Adjust to new world order.
This commit is contained in:
parent
f6113ec38b
commit
a7775214c8
BIN
ApplicationExeCode/Resources/CellFilter.png
Normal file
BIN
ApplicationExeCode/Resources/CellFilter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 625 B |
BIN
ApplicationExeCode/Resources/CellFilter_Polyline.png
Normal file
BIN
ApplicationExeCode/Resources/CellFilter_Polyline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 645 B |
BIN
ApplicationExeCode/Resources/CellFilter_UserDefined.png
Normal file
BIN
ApplicationExeCode/Resources/CellFilter_UserDefined.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 645 B |
@ -222,11 +222,14 @@
|
||||
<file>Erase.svg</file>
|
||||
<file>Close.svg</file>
|
||||
<file>Refresh.svg</file>
|
||||
<file>CellFilter.png</file>
|
||||
<file>CellFilter_Polyline.png</file>
|
||||
<file>FilterFunction.svg</file>
|
||||
<file>FilterParameter.svg</file>
|
||||
<file>ObjectiveFunction.svg</file>
|
||||
<file>ObjectiveFunctionCollection.svg</file>
|
||||
<file>ObjectiveFunctionWeight.svg</file>
|
||||
<file>CellFilter_UserDefined.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationTextAppearance.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimCompletionTemplateCollection.h"
|
||||
#include "RimCorrelationPlot.h"
|
||||
@ -643,7 +643,7 @@ bool RiaApplication::loadProject( const QString& projectFileName,
|
||||
this->setActiveReservoirView( riv );
|
||||
|
||||
RimGridView* rigv = dynamic_cast<RimGridView*>( riv );
|
||||
if ( rigv ) rigv->rangeFilterCollection()->updateIconState();
|
||||
if ( rigv ) rigv->cellFilterCollection()->updateIconState();
|
||||
|
||||
viewProgress.incrementProgress();
|
||||
}
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationTextAppearance.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
@ -13,6 +13,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES
|
||||
AnalysisPlotCommands/CMakeLists_files.cmake
|
||||
ApplicationCommands/CMakeLists_files.cmake
|
||||
AnnotationCommands/CMakeLists_files.cmake
|
||||
CellFilterCommands/CMakeLists_files.cmake
|
||||
ColorLegendCommands/CMakeLists_files.cmake
|
||||
CompletionCommands/CMakeLists_files.cmake
|
||||
CompletionExportCommands/CMakeLists_files.cmake
|
||||
|
@ -15,20 +15,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewInViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewContourMapViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterExecImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertExec.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterFeatureImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewExec.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceIFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceJFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceKFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportFaciesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportFormationNamesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadFormationNamesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellPathFormationNamesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSliceRangeFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionBoxFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportElementPropertyFeature.h
|
||||
@ -114,20 +104,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewInViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewContourMapViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterExecImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertExec.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterFeatureImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewExec.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceIFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceJFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceKFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportFaciesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportFormationNamesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadFormationNamesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellPathFormationNamesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSliceRangeFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionBoxFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportElementPropertyFeature.cpp
|
||||
|
@ -0,0 +1,35 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewUserDefinedFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCellRangeFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceIFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceJFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceKFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSlice3dviewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineFilter3dviewFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewUserDefinedFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCellRangeFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceIFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceJFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceKFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSlice3dviewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineFilter3dviewFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
|
||||
source_group( "CommandFeature\\CellFilterCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewCellRangeFilterFeature.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewCellRangeFilterFeature, "RicNewCellRangeFilterFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewCellRangeFilterFeature::RicNewCellRangeFilterFeature()
|
||||
: RicNewRangeFilterSliceFeature( "New Range Filter", -1 )
|
||||
{
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewCellRangeFilterFeature : public RicNewRangeFilterSliceFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicNewCellRangeFilterFeature();
|
||||
};
|
@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewPolylineFilter3dviewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewPolylineFilter3dviewFeature, "RicNewPolylineFilter3dviewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineFilter3dviewFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineFilter3dviewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
// Get the selected Cell Filter Collection
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
RimCellFilterCollection* filtColl = viewOrComparisonView->cellFilterCollection();
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = viewOrComparisonView->ownerCase();
|
||||
|
||||
RimPolylineFilter* lastCreatedOrUpdated = filtColl->addNewPolylineFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineFilter3dviewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Polyline.png" ) );
|
||||
actionToSetup->setText( "Polyline Filter" );
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -16,6 +15,7 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
@ -23,7 +23,7 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterNewFeature : public caf::CmdFeature
|
||||
class RicNewPolylineFilter3dviewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -17,43 +16,54 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterNewSliceJFeature.h"
|
||||
#include "RicNewPolylineFilterFeature.h"
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicRangeFilterNewSliceJFeature, "RicRangeFilterNewSliceJFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicNewPolylineFilterFeature, "RicNewPolylineFilterFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterNewSliceJFeature::isCommandEnabled()
|
||||
bool RicNewPolylineFilterFeature::isCommandEnabled()
|
||||
{
|
||||
return RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable();
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewSliceJFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewPolylineFilterFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicRangeFilterNewExec* filterExec = RicRangeFilterFeatureImpl::createRangeFilterExecCommand();
|
||||
filterExec->m_jSlice = true;
|
||||
// Find the selected Cell Filter Collection
|
||||
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
|
||||
if ( colls.empty() ) return;
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
// and the case to use
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
|
||||
RimPolylineFilter* lastCreatedOrUpdated = filtColl->addNewPolylineFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewSliceJFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewPolylineFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New J-slice range filter" );
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Polyline.png" ) );
|
||||
actionToSetup->setText( "New Polyline Filter" );
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
// Copyright (C) 2020- 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
|
||||
@ -23,11 +23,12 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewSliceRangeFilter3dViewFeature : public caf::CmdFeature
|
||||
class RicNewPolylineFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
// Copyright (C) 2020- 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
|
||||
@ -16,31 +16,26 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewSliceRangeFilterFeature.h"
|
||||
#include "RicNewRangeFilterSlice3dviewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewSliceRangeFilter3dViewFeature, "RicNewSliceRangeFilter3dViewFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicNewRangeFilterSlice3dviewFeature, "RicNewRangeFilterSlice3dviewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSliceRangeFilter3dViewFeature::isCommandEnabled()
|
||||
bool RicNewRangeFilterSlice3dviewFeature::isCommandEnabled()
|
||||
{
|
||||
RimGridView* view = RiaApplication::instance()->activeGridView();
|
||||
if ( !view ) return false;
|
||||
@ -50,50 +45,38 @@ bool RicNewSliceRangeFilter3dViewFeature::isCommandEnabled()
|
||||
RimViewController* vc = viewOrComparisonView->viewController();
|
||||
if ( !vc ) return true;
|
||||
|
||||
return ( !vc->isRangeFiltersControlled() );
|
||||
return ( !vc->isCellFiltersControlled() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSliceRangeFilter3dViewFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewRangeFilterSlice3dviewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QVariant userData = this->userData();
|
||||
if ( userData.isNull() || userData.type() != QVariant::List ) return;
|
||||
|
||||
if ( !userData.isNull() && userData.type() == QVariant::List )
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
|
||||
RimCase* sourceCase = viewOrComparisonView->ownerCase();
|
||||
|
||||
// Get the selected Cell Filter Collection
|
||||
RimCellFilterCollection* filtColl = viewOrComparisonView->cellFilterCollection();
|
||||
|
||||
// and the parameters from the user choice
|
||||
QVariantList list = userData.toList();
|
||||
CAF_ASSERT( list.size() == 3 );
|
||||
|
||||
int direction = list[0].toInt();
|
||||
int sliceStart = list[1].toInt();
|
||||
int gridIndex = list[2].toInt();
|
||||
|
||||
RimCellFilter* newFilter = filtColl->addNewCellRangeFilter( sourceCase, direction, sliceStart );
|
||||
if ( newFilter )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = viewOrComparisonView->rangeFilterCollection();
|
||||
|
||||
RicRangeFilterNewExec* filterExec = new RicRangeFilterNewExec( rangeFilterCollection );
|
||||
|
||||
QVariantList list = userData.toList();
|
||||
CAF_ASSERT( list.size() == 3 );
|
||||
|
||||
int direction = list[0].toInt();
|
||||
int sliceStart = list[1].toInt();
|
||||
int gridIndex = list[2].toInt();
|
||||
|
||||
filterExec->m_gridIndex = gridIndex;
|
||||
if ( direction == 0 )
|
||||
{
|
||||
filterExec->m_iSlice = true;
|
||||
filterExec->m_iSliceStart = sliceStart;
|
||||
}
|
||||
else if ( direction == 1 )
|
||||
{
|
||||
filterExec->m_jSlice = true;
|
||||
filterExec->m_jSliceStart = sliceStart;
|
||||
}
|
||||
else if ( direction == 2 )
|
||||
{
|
||||
filterExec->m_kSlice = true;
|
||||
filterExec->m_kSliceStart = sliceStart;
|
||||
}
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
newFilter->setGridIndex( gridIndex );
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( newFilter );
|
||||
activeView->setSurfaceDrawstyle();
|
||||
}
|
||||
}
|
||||
@ -101,7 +84,7 @@ void RicNewSliceRangeFilter3dViewFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSliceRangeFilter3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewRangeFilterSlice3dviewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Range.png" ) );
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -24,7 +23,7 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterNewSliceIFeature : public caf::CmdFeature
|
||||
class RicNewRangeFilterSlice3dviewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -17,44 +16,58 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterNewFeature.h"
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
#include "RicNewRangeFilterSliceFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicRangeFilterNewFeature, "RicRangeFilterNewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterNewFeature::isCommandEnabled()
|
||||
RicNewRangeFilterSliceFeature::RicNewRangeFilterSliceFeature( QString cmdText, int sliceDirection )
|
||||
: m_sliceDirection( sliceDirection )
|
||||
, m_sliceText( cmdText )
|
||||
{
|
||||
return RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewFeature::onActionTriggered( bool isChecked )
|
||||
bool RicNewRangeFilterSliceFeature::isCommandEnabled()
|
||||
{
|
||||
RicRangeFilterNewExec* filterExec = RicRangeFilterFeatureImpl::createRangeFilterExecCommand();
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewRangeFilterSliceFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
// Find the selected Cell Filter Collection
|
||||
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
|
||||
if ( colls.empty() ) return;
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
|
||||
RimCellFilter* lastCreatedOrUpdated = filtColl->addNewCellRangeFilter( sourceCase, m_sliceDirection );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewRangeFilterSliceFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Range.png" ) );
|
||||
actionToSetup->setText( "New Range Filter" );
|
||||
actionToSetup->setText( m_sliceText );
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -24,13 +23,17 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterNewSliceKFeature : public caf::CmdFeature
|
||||
class RicNewRangeFilterSliceFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
RicNewRangeFilterSliceFeature( QString cmdText, int sliceDirection );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
QString m_sliceText;
|
||||
int m_sliceDirection;
|
||||
};
|
@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceIFeature.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewRangeFilterSliceIFeature, "RicNewRangeFilterSliceIFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewRangeFilterSliceIFeature::RicNewRangeFilterSliceIFeature()
|
||||
: RicNewRangeFilterSliceFeature( "New Range Filter - I slice", 0 )
|
||||
{
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewRangeFilterSliceIFeature : public RicNewRangeFilterSliceFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicNewRangeFilterSliceIFeature();
|
||||
};
|
@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceJFeature.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewRangeFilterSliceJFeature, "RicNewRangeFilterSliceJFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewRangeFilterSliceJFeature::RicNewRangeFilterSliceJFeature()
|
||||
: RicNewRangeFilterSliceFeature( "New Range Filter - J slice", 1 )
|
||||
{
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewRangeFilterSliceJFeature : public RicNewRangeFilterSliceFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicNewRangeFilterSliceJFeature();
|
||||
};
|
@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceKFeature.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewRangeFilterSliceKFeature, "RicNewRangeFilterSliceKFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewRangeFilterSliceKFeature::RicNewRangeFilterSliceKFeature()
|
||||
: RicNewRangeFilterSliceFeature( "New Range Filter - K slice", 2 )
|
||||
{
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicNewRangeFilterSliceFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewRangeFilterSliceKFeature : public RicNewRangeFilterSliceFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicNewRangeFilterSliceKFeature();
|
||||
};
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -17,44 +16,54 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterNewSliceKFeature.h"
|
||||
#include "RicNewUserDefinedFilterFeature.h"
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimUserDefinedFilter.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicRangeFilterNewSliceKFeature, "RicRangeFilterNewSliceKFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicNewUserDefinedFilterFeature, "RicNewUserDefinedFilterFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterNewSliceKFeature::isCommandEnabled()
|
||||
bool RicNewUserDefinedFilterFeature::isCommandEnabled()
|
||||
{
|
||||
return RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable();
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewSliceKFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewUserDefinedFilterFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicRangeFilterNewExec* filterExec = RicRangeFilterFeatureImpl::createRangeFilterExecCommand();
|
||||
filterExec->m_kSlice = true;
|
||||
// Find the selected Cell Filter Collection
|
||||
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
|
||||
if ( colls.empty() ) return;
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
// and the case to use
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
|
||||
RimUserDefinedFilter* lastCreatedOrUpdated = filtColl->addNewUserDefinedFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewSliceKFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewUserDefinedFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New K-slice range filter" );
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_UserDefined.png" ) );
|
||||
actionToSetup->setText( "New User Defined Filter" );
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020- 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
|
||||
@ -24,7 +23,7 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterNewSliceJFeature : public caf::CmdFeature
|
||||
class RicNewUserDefinedFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAdvancedSnapshotExportDefinition.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
@ -261,11 +261,10 @@ void RicAdvancedSnapshotExportFeature::exportViewVariationsToFolder( RimGridView
|
||||
}
|
||||
else
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter;
|
||||
rimView->rangeFilterCollection()->rangeFilters.push_back( rangeFilter );
|
||||
RimCellRangeFilter* rangeFilter = rimView->cellFilterCollection()->addNewCellRangeFilter( rimCase );
|
||||
|
||||
bool rangeFilterInitState = rimView->rangeFilterCollection()->isActive();
|
||||
rimView->rangeFilterCollection()->isActive = true;
|
||||
bool rangeFilterInitState = rimView->cellFilterCollection()->isActive();
|
||||
rimView->cellFilterCollection()->setActive( true );
|
||||
|
||||
for ( int sliceIndex = msd->startSliceIndex(); sliceIndex <= msd->endSliceIndex(); sliceIndex++ )
|
||||
{
|
||||
@ -289,7 +288,7 @@ void RicAdvancedSnapshotExportFeature::exportViewVariationsToFolder( RimGridView
|
||||
rangeFilter->startIndexK = sliceIndex;
|
||||
}
|
||||
|
||||
rimView->rangeFilterCollection()->updateDisplayModeNotifyManagedViews( rangeFilter );
|
||||
rangeFilter->filterChanged.send();
|
||||
fileName.replace( " ", "_" );
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName( folder, fileName, ".png" );
|
||||
@ -297,10 +296,10 @@ void RicAdvancedSnapshotExportFeature::exportViewVariationsToFolder( RimGridView
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs( absoluteFileName, rimView );
|
||||
}
|
||||
|
||||
rimView->rangeFilterCollection()->rangeFilters.removeChildObject( rangeFilter );
|
||||
rimView->cellFilterCollection()->removeFilter( rangeFilter );
|
||||
delete rangeFilter;
|
||||
|
||||
rimView->rangeFilterCollection()->isActive = rangeFilterInitState;
|
||||
rimView->cellFilterCollection()->setActive( rangeFilterInitState );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells( Rim
|
||||
|
||||
for ( RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters() )
|
||||
{
|
||||
f->isActive = false;
|
||||
f->setActive( false );
|
||||
}
|
||||
|
||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
||||
|
@ -1,113 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterExecImpl.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterExecImpl::RicRangeFilterExecImpl( RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* insertBeforeCellRangeFilter )
|
||||
: CmdExecuteCommand( nullptr )
|
||||
{
|
||||
CVF_ASSERT( rangeFilterCollection );
|
||||
m_cellRangeFilterCollection = rangeFilterCollection;
|
||||
|
||||
m_insertBeforeCellRangeFilter = insertBeforeCellRangeFilter;
|
||||
|
||||
m_iSlice = false;
|
||||
m_jSlice = false;
|
||||
m_kSlice = false;
|
||||
|
||||
m_gridIndex = 0;
|
||||
m_iSliceStart = -1;
|
||||
m_jSliceStart = -1;
|
||||
m_kSliceStart = -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterExecImpl::~RicRangeFilterExecImpl()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilter* RicRangeFilterExecImpl::createRangeFilter()
|
||||
{
|
||||
CVF_ASSERT( m_cellRangeFilterCollection );
|
||||
|
||||
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter();
|
||||
|
||||
size_t flterIndex = m_cellRangeFilterCollection->rangeFilters().size() + 1;
|
||||
|
||||
rangeFilter->setGridIndex( m_gridIndex );
|
||||
|
||||
rangeFilter->name = QString( "New Filter (%1)" ).arg( flterIndex );
|
||||
|
||||
if ( m_iSlice )
|
||||
{
|
||||
rangeFilter->name = QString( "Slice I (%1)" ).arg( flterIndex );
|
||||
}
|
||||
|
||||
if ( m_jSlice )
|
||||
{
|
||||
rangeFilter->name = QString( "Slice J (%1)" ).arg( flterIndex );
|
||||
}
|
||||
|
||||
if ( m_kSlice )
|
||||
{
|
||||
rangeFilter->name = QString( "Slice K (%1)" ).arg( flterIndex );
|
||||
}
|
||||
|
||||
return rangeFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterExecImpl::applyCommandDataOnFilter( RimCellRangeFilter* rangeFilter )
|
||||
{
|
||||
rangeFilter->setGridIndex( m_gridIndex );
|
||||
if ( m_iSlice )
|
||||
{
|
||||
rangeFilter->cellCountI = 1;
|
||||
}
|
||||
|
||||
if ( m_jSlice )
|
||||
{
|
||||
rangeFilter->cellCountJ = 1;
|
||||
}
|
||||
|
||||
if ( m_kSlice )
|
||||
{
|
||||
rangeFilter->cellCountK = 1;
|
||||
}
|
||||
|
||||
if ( m_iSliceStart > -1 ) rangeFilter->startIndexI = m_iSliceStart;
|
||||
if ( m_jSliceStart > -1 ) rangeFilter->startIndexJ = m_jSliceStart;
|
||||
if ( m_kSliceStart > -1 ) rangeFilter->startIndexK = m_kSliceStart;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimCellRangeFilter;
|
||||
class RimCellRangeFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterExecImpl : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicRangeFilterExecImpl( RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* insertBeforeCellRangeFilter = nullptr );
|
||||
~RicRangeFilterExecImpl() override;
|
||||
|
||||
QString name() override = 0;
|
||||
void redo() override = 0;
|
||||
void undo() override = 0;
|
||||
|
||||
public:
|
||||
bool m_iSlice;
|
||||
bool m_jSlice;
|
||||
bool m_kSlice;
|
||||
|
||||
int m_gridIndex;
|
||||
int m_iSliceStart;
|
||||
int m_jSliceStart;
|
||||
int m_kSliceStart;
|
||||
|
||||
protected:
|
||||
RimCellRangeFilter* createRangeFilter();
|
||||
void applyCommandDataOnFilter( RimCellRangeFilter* filter );
|
||||
|
||||
protected:
|
||||
caf::PdmPointer<RimCellRangeFilterCollection> m_cellRangeFilterCollection;
|
||||
caf::PdmPointer<RimCellRangeFilter> m_insertBeforeCellRangeFilter;
|
||||
};
|
@ -1,86 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable()
|
||||
{
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = findRangeFilterCollection();
|
||||
if ( !rangeFilterCollection ) return false;
|
||||
|
||||
RimGridView* view;
|
||||
rangeFilterCollection->firstAncestorOrThisOfType( view );
|
||||
if ( view )
|
||||
{
|
||||
RimViewController* vc = view->viewController();
|
||||
if ( !vc ) return true;
|
||||
return ( !vc->isRangeFiltersControlled() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterNewExec* RicRangeFilterFeatureImpl::createRangeFilterExecCommand()
|
||||
{
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = findRangeFilterCollection();
|
||||
|
||||
RicRangeFilterNewExec* filterExec = new RicRangeFilterNewExec( rangeFilterCollection );
|
||||
|
||||
return filterExec;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilterCollection* RicRangeFilterFeatureImpl::findRangeFilterCollection()
|
||||
{
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = nullptr;
|
||||
|
||||
rangeFilterCollection = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimCellRangeFilterCollection>();
|
||||
|
||||
if ( !rangeFilterCollection )
|
||||
{
|
||||
RimGridView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( view )
|
||||
{
|
||||
rangeFilterCollection = view->rangeFilterCollection();
|
||||
}
|
||||
}
|
||||
|
||||
return rangeFilterCollection;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class RicRangeFilterNewExec;
|
||||
class RimCellRangeFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterFeatureImpl
|
||||
{
|
||||
public:
|
||||
static bool isRangeFilterCommandAvailable();
|
||||
static RicRangeFilterNewExec* createRangeFilterExecCommand();
|
||||
|
||||
public:
|
||||
static RimCellRangeFilterCollection* findRangeFilterCollection();
|
||||
};
|
@ -1,80 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterInsertExec.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterInsertExec::RicRangeFilterInsertExec( RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* rangeFilter )
|
||||
: RicRangeFilterExecImpl( rangeFilterCollection, rangeFilter )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterInsertExec::~RicRangeFilterInsertExec()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicRangeFilterInsertExec::name()
|
||||
{
|
||||
return "Create Range Filter";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterInsertExec::redo()
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = createRangeFilter();
|
||||
if ( rangeFilter )
|
||||
{
|
||||
size_t index = m_cellRangeFilterCollection->rangeFilters.index( m_insertBeforeCellRangeFilter );
|
||||
CVF_ASSERT( index < m_cellRangeFilterCollection->rangeFilters.size() );
|
||||
|
||||
m_cellRangeFilterCollection->rangeFilters.insertAt( static_cast<int>( index ), rangeFilter );
|
||||
|
||||
rangeFilter->setDefaultValues();
|
||||
applyCommandDataOnFilter( rangeFilter );
|
||||
|
||||
m_cellRangeFilterCollection->updateDisplayModeNotifyManagedViews( nullptr );
|
||||
|
||||
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( rangeFilter );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterInsertExec::undo()
|
||||
{
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicRangeFilterExecImpl.h"
|
||||
|
||||
class RimCellRangeFilter;
|
||||
class RimCellRangeFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterInsertExec : public RicRangeFilterExecImpl
|
||||
{
|
||||
public:
|
||||
RicRangeFilterInsertExec( RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* rangeFilter = nullptr );
|
||||
~RicRangeFilterInsertExec() override;
|
||||
|
||||
QString name() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
};
|
@ -1,73 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterInsertFeature.h"
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
#include "RicRangeFilterInsertExec.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicRangeFilterInsertFeature, "RicRangeFilterInsertFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterInsertFeature::isCommandEnabled()
|
||||
{
|
||||
return RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterInsertFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimCellRangeFilter*> selection = selectedCellRangeFilters();
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = RicRangeFilterFeatureImpl::findRangeFilterCollection();
|
||||
|
||||
RicRangeFilterInsertExec* filterExec = new RicRangeFilterInsertExec( rangeFilterCollection, selection[0] );
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterInsertFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Insert Range Filter" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCellRangeFilter*> RicRangeFilterInsertFeature::selectedCellRangeFilters()
|
||||
{
|
||||
std::vector<RimCellRangeFilter*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
return selection;
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterNewExec::RicRangeFilterNewExec( RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* rangeFilter )
|
||||
: RicRangeFilterExecImpl( rangeFilterCollection, rangeFilter )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterNewExec::~RicRangeFilterNewExec()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicRangeFilterNewExec::name()
|
||||
{
|
||||
if ( m_iSlice )
|
||||
return "Create I Slice Filter";
|
||||
else if ( m_jSlice )
|
||||
return "Create J Slice Filter";
|
||||
else if ( m_kSlice )
|
||||
return "Create K Slice Filter";
|
||||
|
||||
return "Create Range Filter";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewExec::redo()
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = createRangeFilter();
|
||||
if ( rangeFilter )
|
||||
{
|
||||
m_cellRangeFilterCollection->rangeFilters.push_back( rangeFilter );
|
||||
|
||||
rangeFilter->setDefaultValues();
|
||||
applyCommandDataOnFilter( rangeFilter );
|
||||
|
||||
m_cellRangeFilterCollection->updateDisplayModeNotifyManagedViews( nullptr );
|
||||
|
||||
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( rangeFilter, false );
|
||||
|
||||
// Trigger update of view following the range filter update
|
||||
RimGridView* view = nullptr;
|
||||
m_cellRangeFilterCollection->firstAncestorOrThisOfTypeAsserted( view );
|
||||
view->rangeFiltersUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewExec::undo()
|
||||
{
|
||||
assert( m_cellRangeFilterCollection );
|
||||
|
||||
m_cellRangeFilterCollection->rangeFilters.erase( m_cellRangeFilterCollection->rangeFilters.size() - 1 );
|
||||
|
||||
m_cellRangeFilterCollection->updateDisplayModeNotifyManagedViews( nullptr );
|
||||
|
||||
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicRangeFilterExecImpl.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterNewExec : public RicRangeFilterExecImpl
|
||||
{
|
||||
public:
|
||||
RicRangeFilterNewExec( RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter = nullptr );
|
||||
~RicRangeFilterNewExec() override;
|
||||
|
||||
QString name() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
};
|
@ -1,59 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterNewSliceIFeature.h"
|
||||
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicRangeFilterNewSliceIFeature, "RicRangeFilterNewSliceIFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterNewSliceIFeature::isCommandEnabled()
|
||||
{
|
||||
return RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewSliceIFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicRangeFilterNewExec* filterExec = RicRangeFilterFeatureImpl::createRangeFilterExecCommand();
|
||||
filterExec->m_iSlice = true;
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( filterExec );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewSliceIFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New I-slice range filter" );
|
||||
}
|
@ -44,7 +44,7 @@ public:
|
||||
// viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object
|
||||
proj->viewLinkerCollection->viewLinker.removeChildObject( viewLinker );
|
||||
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
viewLinker->applyCellFilterCollectionByUserChoice();
|
||||
|
||||
delete viewLinker;
|
||||
|
||||
|
@ -65,7 +65,7 @@ void RicSetMasterViewFeature::onActionTriggered( bool isChecked )
|
||||
RimProject* proj = RimProject::current();
|
||||
RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker();
|
||||
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
viewLinker->applyCellFilterCollectionByUserChoice();
|
||||
|
||||
RimGridView* previousMasterView = viewLinker->masterView();
|
||||
|
||||
|
@ -66,14 +66,14 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( viewController )
|
||||
{
|
||||
viewController->applyRangeFilterCollectionByUserChoice();
|
||||
viewController->applyCellFilterCollectionByUserChoice();
|
||||
delete viewController;
|
||||
viewLinker->removeViewController( nullptr ); // Remove the slots in the vector that was set to nullptr by the
|
||||
// destructor
|
||||
}
|
||||
else if ( viewLinker )
|
||||
{
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
viewLinker->applyCellFilterCollectionByUserChoice();
|
||||
|
||||
RimGridView* firstControlledView = viewLinker->firstControlledView();
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include "RicPolylineTarget3dEditor.h"
|
||||
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "cafPickEventHandler.h"
|
||||
|
||||
@ -54,7 +54,7 @@ RicPolyline3dEditor::~RicPolyline3dEditor()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolyline3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
{
|
||||
auto* geomDef = dynamic_cast<RimUserDefinedPolylinesAnnotation*>( this->pdmObject() );
|
||||
auto* pickerInterface = dynamic_cast<RimPolylinePickerInterface*>( this->pdmObject() );
|
||||
|
||||
for ( auto targetEditor : m_targetEditors )
|
||||
{
|
||||
@ -62,22 +62,18 @@ void RicPolyline3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
}
|
||||
m_targetEditors.clear();
|
||||
|
||||
if ( !geomDef ) return;
|
||||
if ( !pickerInterface ) return;
|
||||
|
||||
geomDef->objectEditorAttribute( "", &m_attribute );
|
||||
if ( m_attribute.pickEventHandler != nullptr )
|
||||
if ( pickerInterface->pickingEnabled() )
|
||||
{
|
||||
if ( m_attribute.enablePicking )
|
||||
{
|
||||
m_attribute.pickEventHandler->registerAsPickEventHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_attribute.pickEventHandler->unregisterAsPickEventHandler();
|
||||
}
|
||||
pickerInterface->pickEventHandler()->registerAsPickEventHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
pickerInterface->pickEventHandler()->unregisterAsPickEventHandler();
|
||||
}
|
||||
|
||||
std::vector<RimPolylineTarget*> targets = geomDef->activeTargets();
|
||||
std::vector<RimPolylineTarget*> targets = pickerInterface->activeTargets();
|
||||
|
||||
for ( auto target : targets )
|
||||
{
|
||||
|
@ -82,9 +82,6 @@ void RicPolylineTarget3dEditor::configureAndUpdateUi( const QString& uiConfigNam
|
||||
return;
|
||||
}
|
||||
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted( polylineDef );
|
||||
|
||||
target->targetPointUiCapability()->addFieldEditor( this );
|
||||
|
||||
if ( m_manipulator.isNull() )
|
||||
@ -139,9 +136,6 @@ void RicPolylineTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
|
||||
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted( polylineDef );
|
||||
|
||||
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin );
|
||||
domainOrigin.z() = -domainOrigin.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization<cvf::Vec3d>::convert( domainOrigin );
|
||||
@ -171,12 +165,8 @@ void RicPolylineTarget3dEditor::slotSelectedIn3D()
|
||||
void RicPolylineTarget3dEditor::slotDragFinished()
|
||||
{
|
||||
RimPolylineTarget* target = dynamic_cast<RimPolylineTarget*>( this->pdmObject() );
|
||||
if ( !target )
|
||||
if ( target )
|
||||
{
|
||||
return;
|
||||
target->triggerVisualizationUpdate();
|
||||
}
|
||||
|
||||
RimAnnotationCollectionBase* annColl;
|
||||
target->firstAncestorOrThisOfTypeAsserted( annColl );
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ void RicDeletePolylineTargetFeature::onActionTriggered( bool isChecked )
|
||||
polylineDef->deleteTarget( target );
|
||||
}
|
||||
|
||||
polylineDef->updateConnectedEditors();
|
||||
polylineDef->updateVisualization();
|
||||
polylineDef->updateEditorsAndVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,8 +105,7 @@ void RicNewPolylineTargetFeature::onActionTriggered( bool isChecked )
|
||||
newTarget->setAsPointTargetXYD( { newPos[0], newPos[1], -newPos[2] } );
|
||||
|
||||
polylineDef->insertTarget( firstTarget, newTarget );
|
||||
polylineDef->updateConnectedEditors();
|
||||
polylineDef->updateVisualization();
|
||||
polylineDef->updateEditorsAndVisualization();
|
||||
|
||||
return;
|
||||
}
|
||||
@ -155,8 +154,7 @@ void RicNewPolylineTargetFeature::onActionTriggered( bool isChecked )
|
||||
polylineDef->insertTarget( nullptr, newTarget );
|
||||
}
|
||||
|
||||
polylineDef->updateConnectedEditors();
|
||||
polylineDef->updateVisualization();
|
||||
polylineDef->updateEditorsAndVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
#include "RivPolylinesAnnotationSourceInfo.h"
|
||||
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -40,8 +42,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolylineTargetsPickEventHandler::RicPolylineTargetsPickEventHandler( RimUserDefinedPolylinesAnnotation* polylineDef )
|
||||
: m_polylineDef( polylineDef )
|
||||
RicPolylineTargetsPickEventHandler::RicPolylineTargetsPickEventHandler( RimPolylinePickerInterface* objDef )
|
||||
: m_objectDef( objDef )
|
||||
{
|
||||
}
|
||||
|
||||
@ -74,21 +76,20 @@ void RicPolylineTargetsPickEventHandler::notifyUnregistered()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPolylineTargetsPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eventObject )
|
||||
{
|
||||
if ( m_polylineDef )
|
||||
if ( m_objectDef )
|
||||
{
|
||||
Rim3dView* rimView = eventObject.m_view;
|
||||
|
||||
auto firstPickItem = eventObject.m_pickItemInfos.front();
|
||||
auto targetPointInDomain =
|
||||
const auto& firstPickItem = eventObject.m_pickItemInfos.front();
|
||||
auto targetPointInDomain =
|
||||
rimView->displayCoordTransform()->transformToDomainCoord( firstPickItem.globalPickedPoint() );
|
||||
|
||||
auto* newTarget = new RimPolylineTarget();
|
||||
newTarget->setAsPointTargetXYD(
|
||||
cvf::Vec3d( targetPointInDomain.x(), targetPointInDomain.y(), -targetPointInDomain.z() ) );
|
||||
|
||||
m_polylineDef->insertTarget( nullptr, newTarget );
|
||||
m_polylineDef->updateConnectedEditors();
|
||||
m_polylineDef->updateVisualization();
|
||||
m_objectDef->insertTarget( nullptr, newTarget );
|
||||
m_objectDef->updateEditorsAndVisualization();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -19,10 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Ric3dViewPickEventHandler.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimUserDefinedPolylinesAnnotation;
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -30,7 +27,7 @@ class RimUserDefinedPolylinesAnnotation;
|
||||
class RicPolylineTargetsPickEventHandler : public Ric3dViewPickEventHandler
|
||||
{
|
||||
public:
|
||||
RicPolylineTargetsPickEventHandler( RimUserDefinedPolylinesAnnotation* polylineDef );
|
||||
RicPolylineTargetsPickEventHandler( RimPolylinePickerInterface* picker );
|
||||
~RicPolylineTargetsPickEventHandler();
|
||||
|
||||
void registerAsPickEventHandler() override;
|
||||
@ -40,5 +37,5 @@ protected:
|
||||
void notifyUnregistered() override;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimUserDefinedPolylinesAnnotation> m_polylineDef;
|
||||
RimPolylinePickerInterface* m_objectDef;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@ -150,7 +150,7 @@ std::vector<RivGeoMechPartMgrCache::Key> RivGeoMechVizLogic::keysToVisiblePartMg
|
||||
{
|
||||
visiblePartMgrs.push_back( RivGeoMechPartMgrCache::Key( PROPERTY_FILTERED, timeStepIndex ) );
|
||||
}
|
||||
else if ( m_geomechView->rangeFilterCollection()->hasActiveFilters() )
|
||||
else if ( m_geomechView->cellFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
visiblePartMgrs.push_back( RivGeoMechPartMgrCache::Key( RANGE_FILTERED, -1 ) );
|
||||
}
|
||||
@ -210,23 +210,23 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr( RivGeoMechPartMgrCache
|
||||
if ( pMgrKey.geometryType() == RANGE_FILTERED )
|
||||
{
|
||||
cvf::CellRangeFilter cellRangeFilter;
|
||||
m_geomechView->rangeFilterCollection()->compoundCellRangeFilter( &cellRangeFilter, femPartIdx );
|
||||
m_geomechView->cellFilterCollection()->compoundCellRangeFilter( &cellRangeFilter, femPartIdx );
|
||||
RivFemElmVisibilityCalculator::computeRangeVisibility( elmVisibility.p(),
|
||||
caseData->femParts()->part( femPartIdx ),
|
||||
cellRangeFilter );
|
||||
}
|
||||
else if ( pMgrKey.geometryType() == PROPERTY_FILTERED )
|
||||
{
|
||||
RivGeoMechPartMgr* rangefiltered = nullptr;
|
||||
if ( m_geomechView->rangeFilterCollection()->hasActiveFilters() )
|
||||
RivGeoMechPartMgr* cellfiltered = nullptr;
|
||||
if ( m_geomechView->cellFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
rangefiltered = getUpdatedPartMgr( RivGeoMechPartMgrCache::Key( RANGE_FILTERED, -1 ) );
|
||||
cellfiltered = getUpdatedPartMgr( RivGeoMechPartMgrCache::Key( RANGE_FILTERED, -1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rangefiltered = getUpdatedPartMgr( RivGeoMechPartMgrCache::Key( ALL_CELLS, -1 ) );
|
||||
cellfiltered = getUpdatedPartMgr( RivGeoMechPartMgrCache::Key( ALL_CELLS, -1 ) );
|
||||
}
|
||||
cvf::ref<cvf::UByteArray> rangeFiltVisibility = rangefiltered->cellVisibility( femPartIdx );
|
||||
cvf::ref<cvf::UByteArray> rangeFiltVisibility = cellfiltered->cellVisibility( femPartIdx );
|
||||
|
||||
RivFemElmVisibilityCalculator::computePropertyVisibility( elmVisibility.p(),
|
||||
caseData->femParts()->part( femPartIdx ),
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
@ -363,11 +363,11 @@ void RivReservoirViewPartMgr::computeVisibility( cvf::UByteArray* cellVisibility
|
||||
ensureStaticGeometryPartsCreated( ACTIVE );
|
||||
|
||||
nativeVisibility = m_geometries[ACTIVE].cellVisibility( gridIdx );
|
||||
computeRangeVisibility( geometryType,
|
||||
cellVisibility,
|
||||
grid,
|
||||
nativeVisibility.p(),
|
||||
m_reservoirView->rangeFilterCollection() );
|
||||
computeFilterVisibility( geometryType,
|
||||
cellVisibility,
|
||||
grid,
|
||||
nativeVisibility.p(),
|
||||
m_reservoirView->cellFilterCollection() );
|
||||
}
|
||||
break;
|
||||
case RANGE_FILTERED_INACTIVE:
|
||||
@ -376,11 +376,11 @@ void RivReservoirViewPartMgr::computeVisibility( cvf::UByteArray* cellVisibility
|
||||
ensureStaticGeometryPartsCreated( INACTIVE );
|
||||
|
||||
nativeVisibility = m_geometries[INACTIVE].cellVisibility( gridIdx );
|
||||
computeRangeVisibility( geometryType,
|
||||
cellVisibility,
|
||||
grid,
|
||||
nativeVisibility.p(),
|
||||
m_reservoirView->rangeFilterCollection() );
|
||||
computeFilterVisibility( geometryType,
|
||||
cellVisibility,
|
||||
grid,
|
||||
nativeVisibility.p(),
|
||||
m_reservoirView->cellFilterCollection() );
|
||||
}
|
||||
break;
|
||||
case RANGE_FILTERED_WELL_CELLS:
|
||||
@ -389,11 +389,11 @@ void RivReservoirViewPartMgr::computeVisibility( cvf::UByteArray* cellVisibility
|
||||
ensureStaticGeometryPartsCreated( ALL_WELL_CELLS );
|
||||
|
||||
nativeVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility( gridIdx );
|
||||
computeRangeVisibility( geometryType,
|
||||
cellVisibility,
|
||||
grid,
|
||||
nativeVisibility.p(),
|
||||
m_reservoirView->rangeFilterCollection() );
|
||||
computeFilterVisibility( geometryType,
|
||||
cellVisibility,
|
||||
grid,
|
||||
nativeVisibility.p(),
|
||||
m_reservoirView->cellFilterCollection() );
|
||||
}
|
||||
break;
|
||||
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
|
||||
@ -466,8 +466,8 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry( size_t
|
||||
std::vector<RigGridBase*> grids;
|
||||
res->allGrids( &grids );
|
||||
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters();
|
||||
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
bool hasActiveCellFilters = m_reservoirView->cellFilterCollection()->hasActiveFilters();
|
||||
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
for ( size_t gIdx = 0; gIdx < grids.size(); ++gIdx )
|
||||
{
|
||||
@ -475,7 +475,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry( size_t
|
||||
cvf::ref<cvf::UByteArray> rangeVisibility;
|
||||
cvf::ref<cvf::UByteArray> fenceVisibility;
|
||||
|
||||
if ( hasActiveRangeFilters && hasVisibleWellCells )
|
||||
if ( hasActiveCellFilters && hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( RANGE_FILTERED );
|
||||
ensureStaticGeometryPartsCreated( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
@ -483,21 +483,21 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry( size_t
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility( gIdx );
|
||||
fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility( gIdx );
|
||||
}
|
||||
else if ( hasActiveRangeFilters && !hasVisibleWellCells )
|
||||
else if ( hasActiveCellFilters && !hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( RANGE_FILTERED );
|
||||
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility( gIdx );
|
||||
fenceVisibility = m_geometries[RANGE_FILTERED].cellVisibility( gIdx );
|
||||
}
|
||||
else if ( !hasActiveRangeFilters && hasVisibleWellCells )
|
||||
else if ( !hasActiveCellFilters && hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( VISIBLE_WELL_FENCE_CELLS );
|
||||
|
||||
rangeVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility( gIdx );
|
||||
fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility( gIdx );
|
||||
}
|
||||
else if ( !hasActiveRangeFilters && !hasVisibleWellCells )
|
||||
else if ( !hasActiveCellFilters && !hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( ACTIVE );
|
||||
|
||||
@ -549,8 +549,8 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry( size_t frameIn
|
||||
std::vector<RigGridBase*> grids;
|
||||
res->allGrids( &grids );
|
||||
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters();
|
||||
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
bool hasActiveCellFilters = m_reservoirView->cellFilterCollection()->hasActiveFilters();
|
||||
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
for ( size_t gIdx = 0; gIdx < grids.size(); ++gIdx )
|
||||
{
|
||||
@ -559,7 +559,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry( size_t frameIn
|
||||
cvf::ref<cvf::UByteArray> wellCellsOutsideRange;
|
||||
cvf::ref<cvf::UByteArray> wellFenceCells;
|
||||
|
||||
if ( hasActiveRangeFilters && hasVisibleWellCells )
|
||||
if ( hasActiveCellFilters && hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( RANGE_FILTERED_WELL_CELLS );
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility( gIdx );
|
||||
@ -570,14 +570,14 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry( size_t frameIn
|
||||
ensureStaticGeometryPartsCreated( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
wellFenceCells = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility( gIdx );
|
||||
}
|
||||
else if ( hasActiveRangeFilters && !hasVisibleWellCells )
|
||||
else if ( hasActiveCellFilters && !hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( RANGE_FILTERED_WELL_CELLS );
|
||||
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility( gIdx );
|
||||
wellCellsOutsideRange = rangeVisibility;
|
||||
wellFenceCells = rangeVisibility;
|
||||
}
|
||||
else if ( !hasActiveRangeFilters && hasVisibleWellCells )
|
||||
else if ( !hasActiveCellFilters && hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( VISIBLE_WELL_CELLS );
|
||||
wellCellsOutsideRange = m_geometries[VISIBLE_WELL_CELLS].cellVisibility( gIdx );
|
||||
@ -587,7 +587,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry( size_t frameIn
|
||||
|
||||
rangeVisibility = wellCellsOutsideRange;
|
||||
}
|
||||
else if ( !hasActiveRangeFilters && !hasVisibleWellCells )
|
||||
else if ( !hasActiveCellFilters && !hasVisibleWellCells )
|
||||
{
|
||||
ensureStaticGeometryPartsCreated( ALL_WELL_CELLS );
|
||||
wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility( gIdx );
|
||||
@ -738,27 +738,27 @@ void RivReservoirViewPartMgr::copyByteArray( cvf::UByteArray* destination, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::computeRangeVisibility( RivCellSetEnum geometryType,
|
||||
cvf::UByteArray* cellVisibility,
|
||||
const RigGridBase* grid,
|
||||
const cvf::UByteArray* nativeVisibility,
|
||||
const RimCellRangeFilterCollection* rangeFilterColl )
|
||||
void RivReservoirViewPartMgr::computeFilterVisibility( RivCellSetEnum geometryType,
|
||||
cvf::UByteArray* cellVisibility,
|
||||
const RigGridBase* grid,
|
||||
const cvf::UByteArray* nativeVisibility,
|
||||
const RimCellFilterCollection* cellFilterColl )
|
||||
{
|
||||
CVF_ASSERT( cellVisibility != nullptr );
|
||||
CVF_ASSERT( nativeVisibility != nullptr );
|
||||
CVF_ASSERT( rangeFilterColl != nullptr );
|
||||
CVF_ASSERT( cellFilterColl != nullptr );
|
||||
|
||||
CVF_ASSERT( grid != nullptr );
|
||||
CVF_ASSERT( nativeVisibility->size() == grid->cellCount() );
|
||||
|
||||
// Initialize range filter with native visibility
|
||||
// Initialize filter with native visibility
|
||||
if ( cellVisibility != nativeVisibility ) ( *cellVisibility ) = ( *nativeVisibility );
|
||||
|
||||
if ( rangeFilterColl->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells() )
|
||||
if ( cellFilterColl->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
// Build range filter for current grid
|
||||
// Build cell filter for current grid
|
||||
cvf::CellRangeFilter gridCellRangeFilter;
|
||||
rangeFilterColl->compoundCellRangeFilter( &gridCellRangeFilter, grid->gridIndex() );
|
||||
cellFilterColl->compoundCellRangeFilter( &gridCellRangeFilter, grid->gridIndex() );
|
||||
|
||||
const RigLocalGrid* lgr = nullptr;
|
||||
cvf::ref<cvf::UByteArray> parentGridVisibilities;
|
||||
@ -781,8 +781,8 @@ void RivReservoirViewPartMgr::computeRangeVisibility( RivCellSetEnum
|
||||
parentGridVisibilities = reservoirGridPartMgr->cellVisibility( parentGridIndex );
|
||||
}
|
||||
|
||||
bool hasAdditiveRangeFilters = rangeFilterColl->hasActiveIncludeFilters() ||
|
||||
m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
bool hasAdditiveFilters = cellFilterColl->hasActiveIncludeFilters() ||
|
||||
m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int cellIndex = 0; cellIndex < static_cast<int>( grid->cellCount() ); cellIndex++ )
|
||||
@ -807,7 +807,7 @@ void RivReservoirViewPartMgr::computeRangeVisibility( RivCellSetEnum
|
||||
|
||||
bool nativeRangeVisibility = false;
|
||||
|
||||
if ( hasAdditiveRangeFilters )
|
||||
if ( hasAdditiveFilters )
|
||||
{
|
||||
nativeRangeVisibility =
|
||||
gridCellRangeFilter.isCellVisible( mainGridI, mainGridJ, mainGridK, isInSubGridArea );
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
class RimEclipseView;
|
||||
class RigGridBase;
|
||||
class RimCellRangeFilterCollection;
|
||||
class RimCellFilterCollection;
|
||||
class RimEclipsePropertyFilterCollection;
|
||||
class RigActiveCellInfo;
|
||||
class RimEclipseCellColors;
|
||||
@ -121,11 +121,11 @@ private:
|
||||
bool inactiveCellsIsVisible,
|
||||
bool activeCellsIsVisible );
|
||||
|
||||
void computeRangeVisibility( RivCellSetEnum geometryType,
|
||||
cvf::UByteArray* cellVisibilities,
|
||||
const RigGridBase* grid,
|
||||
const cvf::UByteArray* nativeVisibility,
|
||||
const RimCellRangeFilterCollection* rangeFilterColl );
|
||||
void computeFilterVisibility( RivCellSetEnum geometryType,
|
||||
cvf::UByteArray* cellVisibilities,
|
||||
const RigGridBase* grid,
|
||||
const cvf::UByteArray* nativeVisibility,
|
||||
const RimCellFilterCollection* rangeFilterColl );
|
||||
void computeOverriddenCellVisibility( cvf::UByteArray* cellVisibility, const RigGridBase* grid );
|
||||
|
||||
static void copyByteArray( cvf::UByteArray* dest, const cvf::UByteArray* source );
|
||||
|
@ -1,7 +1,24 @@
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 - Equinor
|
||||
//
|
||||
// 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 "RimPolylineTarget.h"
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include <cmath>
|
||||
|
||||
@ -91,9 +108,17 @@ void RimPolylineTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimUserDefinedPolylinesAnnotation* polyline;
|
||||
firstAncestorOrThisOfTypeAsserted( polyline );
|
||||
polyline->updateVisualization();
|
||||
triggerVisualizationUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::triggerVisualizationUpdate() const
|
||||
{
|
||||
RimPolylinePickerInterface* ppInterface;
|
||||
firstAncestorOrThisOfTypeAsserted( ppInterface );
|
||||
if ( ppInterface ) ppInterface->updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
caf::PdmUiFieldHandle* targetPointUiCapability();
|
||||
void enableFullUpdate( bool enable );
|
||||
|
||||
void triggerVisualizationUpdate() const;
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
@ -173,6 +173,15 @@ std::pair<RimPolylineTarget*, RimPolylineTarget*>
|
||||
return { before, after };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::updateEditorsAndVisualization()
|
||||
{
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -180,8 +189,7 @@ void RimUserDefinedPolylinesAnnotation::updateVisualization()
|
||||
{
|
||||
RimAnnotationCollection* annColl = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( annColl );
|
||||
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
if ( annColl ) annColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -193,6 +201,22 @@ void RimUserDefinedPolylinesAnnotation::enablePicking( bool enable )
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimUserDefinedPolylinesAnnotation::pickingEnabled() const
|
||||
{
|
||||
return m_enablePicking();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PickEventHandler* RimUserDefinedPolylinesAnnotation::pickEventHandler() const
|
||||
{
|
||||
return m_pickTargetsEventHandler.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,8 @@
|
||||
#pragma once
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
|
||||
@ -32,7 +34,7 @@ class RimPolylineTarget;
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RimUserDefinedPolylinesAnnotation : public RimPolylinesAnnotation
|
||||
class RimUserDefinedPolylinesAnnotation : public RimPolylinesAnnotation, public RimPolylinePickerInterface
|
||||
{
|
||||
friend class RimUserDefinedPolylinesAnnotationInView;
|
||||
|
||||
@ -44,17 +46,22 @@ public:
|
||||
RimUserDefinedPolylinesAnnotation();
|
||||
~RimUserDefinedPolylinesAnnotation() override;
|
||||
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() override;
|
||||
std::vector<RimPolylineTarget*> activeTargets() const;
|
||||
bool isEmpty() override;
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() override;
|
||||
bool isEmpty() override;
|
||||
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
|
||||
void updateEditorsAndVisualization() override;
|
||||
void updateVisualization() override;
|
||||
|
||||
std::vector<RimPolylineTarget*> activeTargets() const override;
|
||||
bool pickingEnabled() const override;
|
||||
caf::PickEventHandler* pickEventHandler() const override;
|
||||
|
||||
void appendTarget( const cvf::Vec3d& defaultPos = cvf::Vec3d::ZERO );
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert );
|
||||
void deleteTarget( RimPolylineTarget* targetTodelete );
|
||||
|
||||
std::pair<RimPolylineTarget*, RimPolylineTarget*>
|
||||
findActiveTargetsAroundInsertionPoint( const RimPolylineTarget* targetToInsertBefore );
|
||||
void updateVisualization();
|
||||
findActiveTargetsAroundInsertionPoint( const RimPolylineTarget* targetToInsertBefore );
|
||||
|
||||
void enablePicking( bool enable );
|
||||
|
||||
|
@ -157,6 +157,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimColorLegendCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegend.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegendItem.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAbstractPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinePickerInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpTableExtractor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCaseDisplayNameTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunctionCollection.h
|
||||
|
@ -1,26 +1,30 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellRangeFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellRangeFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPropertyFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPropertyFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipsePropertyFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipsePropertyFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPropertyFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPropertyFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedFilter.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellRangeFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellRangeFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPropertyFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPropertyFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipsePropertyFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipsePropertyFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPropertyFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPropertyFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedFilter.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -18,9 +18,12 @@
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RigReservoirGridTools.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -33,20 +36,25 @@ void caf::AppEnum<RimCellFilter::FilterModeType>::setUp()
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCellFilter, "CellFilter" );
|
||||
// CAF_PDM_SOURCE_INIT( RimCellFilter, "CellFilter" );
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCellFilter, "CellFilter", "CellFilter" ); // Do not use. Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellFilter::RimCellFilter()
|
||||
: filterChanged( this )
|
||||
{
|
||||
CAF_PDM_InitObject( "Cell Filter", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &name, "UserDescription", QString( "Filter Name" ), "Name", "", "", "" );
|
||||
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
|
||||
isActive.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitField( &m_name, "UserDescription", QString( "New filter" ), "Name", "", "", "" );
|
||||
CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &filterMode, "FilterType", "Filter Type", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterType", "Filter Type", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid", "", "", "" );
|
||||
CAF_PDM_InitField( &m_propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -61,7 +69,80 @@ RimCellFilter::~RimCellFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellFilter::name() const
|
||||
{
|
||||
return m_name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setName( QString filtername )
|
||||
{
|
||||
m_name = filtername;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setActive( bool active )
|
||||
{
|
||||
m_isActive = active;
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilter::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::updateActiveState( bool isControlled )
|
||||
{
|
||||
m_isActive.uiCapability()->setUiReadOnly( isControlled );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::AppEnum<RimCellFilter::FilterModeType> RimCellFilter::filterMode() const
|
||||
{
|
||||
return m_filterMode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setGridIndex( int gridIndex )
|
||||
{
|
||||
m_gridIndex = gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimCellFilter::gridIndex() const
|
||||
{
|
||||
return m_gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilter::propagateToSubGrids() const
|
||||
{
|
||||
return m_propagateToSubGrids();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -82,7 +163,7 @@ void RimCellFilter::updateIconState()
|
||||
iconProvider.setOverlayResourceString( ":/Minus.png" );
|
||||
}
|
||||
|
||||
iconProvider.setActive( isActive && !isActive.uiCapability()->isUiReadOnly() );
|
||||
iconProvider.setActive( m_isActive && !m_isActive.uiCapability()->isUiReadOnly() );
|
||||
|
||||
this->setUiIcon( iconProvider );
|
||||
}
|
||||
@ -92,5 +173,104 @@ void RimCellFilter::updateIconState()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_name );
|
||||
auto group = uiOrdering.addNewGroup( "General" );
|
||||
group->add( &m_filterMode );
|
||||
group->add( &m_gridIndex );
|
||||
group->add( &m_propagateToSubGrids );
|
||||
|
||||
bool readOnlyState = isFilterControlled();
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> objFields;
|
||||
this->fields( objFields );
|
||||
for ( auto& objField : objFields )
|
||||
{
|
||||
objField->uiCapability()->setUiReadOnly( readOnlyState );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellFilter::modeString() const
|
||||
{
|
||||
if ( m_filterMode == RimCellFilter::FilterModeType::INCLUDE ) return "include";
|
||||
return "exclude";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const cvf::StructGridInterface* RimCellFilter::selectedGrid() const
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rimCase );
|
||||
|
||||
int clampedIndex = gridIndex();
|
||||
if ( clampedIndex >= RigReservoirGridTools::gridCount( rimCase ) )
|
||||
{
|
||||
clampedIndex = 0;
|
||||
}
|
||||
|
||||
return RigReservoirGridTools::gridByIndex( rimCase, clampedIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( useOptionsOnly ) ( *useOptionsOnly ) = true;
|
||||
|
||||
if ( &m_gridIndex == fieldNeedingOptions )
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rimCase );
|
||||
|
||||
for ( int gIdx = 0; gIdx < RigReservoirGridTools::gridCount( rimCase ); ++gIdx )
|
||||
{
|
||||
QString gridName;
|
||||
|
||||
gridName += RigReservoirGridTools::gridName( rimCase, gIdx );
|
||||
if ( gIdx == 0 )
|
||||
{
|
||||
if ( gridName.isEmpty() )
|
||||
gridName += "Main Grid";
|
||||
else
|
||||
gridName += " (Main Grid)";
|
||||
}
|
||||
|
||||
caf::PdmOptionItemInfo item( gridName, (int)gIdx );
|
||||
options.push_back( item );
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilter::isFilterControlled() const
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( rimView );
|
||||
|
||||
bool isFilterControlled = false;
|
||||
if ( rimView && rimView->viewController() && rimView->viewController()->isCellFiltersControlled() )
|
||||
{
|
||||
isFilterControlled = true;
|
||||
}
|
||||
|
||||
return isFilterControlled;
|
||||
}
|
||||
|
@ -21,6 +21,13 @@
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafSignal.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class StructGridInterface;
|
||||
class CellRangeFilter;
|
||||
} // namespace cvf
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -37,16 +44,41 @@ public:
|
||||
EXCLUDE
|
||||
};
|
||||
|
||||
caf::Signal<> filterChanged;
|
||||
|
||||
RimCellFilter();
|
||||
~RimCellFilter() override;
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmField<caf::AppEnum<FilterModeType>> filterMode;
|
||||
QString name() const;
|
||||
bool isActive() const;
|
||||
caf::AppEnum<FilterModeType> filterMode() const;
|
||||
void setName( QString filtername );
|
||||
void setActive( bool active );
|
||||
QString modeString() const;
|
||||
bool propagateToSubGrids() const;
|
||||
|
||||
void setGridIndex( int gridIndex );
|
||||
int gridIndex() const;
|
||||
|
||||
void updateIconState();
|
||||
void updateActiveState( bool isControlled );
|
||||
|
||||
virtual void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) = 0;
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
bool isFilterControlled() const;
|
||||
|
||||
const cvf::StructGridInterface* selectedGrid() const;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<caf::AppEnum<FilterModeType>> m_filterMode;
|
||||
caf::PdmField<int> m_gridIndex;
|
||||
caf::PdmField<bool> m_propagateToSubGrids; // Do propagate the effects to the sub-grids
|
||||
};
|
||||
|
@ -0,0 +1,341 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RimCellFilterCollection.h"
|
||||
|
||||
#include "RigPolyLinesData.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimUserDefinedFilter.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCellFilterCollection, "RimCellFilterCollection", "CellRangeFilterCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellFilterCollection::RimCellFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Cell Filters", ":/CellFilter.png", "", "" );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_isActive, "Active", true, "Active", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_cellFilters, "CellFilters", "Filters", "", "", "" );
|
||||
m_cellFilters.uiCapability()->setUiTreeHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &m_cellFilters );
|
||||
|
||||
// for backwards project file compatibility with old CellRangeFilterCollection
|
||||
CAF_PDM_InitFieldNoDefault( &m_rangeFilters_OBSOLETE, "RangeFilters", "Range Filters", "", "", "" );
|
||||
m_rangeFilters_OBSOLETE.uiCapability()->setUiHidden( true );
|
||||
m_rangeFilters_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellFilterCollection::~RimCellFilterCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::isEmpty() const
|
||||
{
|
||||
return m_cellFilters.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::setActive( bool bActive )
|
||||
{
|
||||
m_isActive = bActive;
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCellFilter*> RimCellFilterCollection::filters() const
|
||||
{
|
||||
return m_cellFilters.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::initAfterRead()
|
||||
{
|
||||
std::list<RimCellRangeFilter*> filters;
|
||||
|
||||
// get any old range filters and put them in the new cell filter collection
|
||||
for ( auto& filter : m_rangeFilters_OBSOLETE )
|
||||
{
|
||||
filters.push_back( filter );
|
||||
}
|
||||
for ( auto& filter : filters )
|
||||
{
|
||||
m_rangeFilters_OBSOLETE.removeChildObject( filter );
|
||||
m_cellFilters.push_back( filter );
|
||||
}
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
{
|
||||
filter->filterChanged.connect( this, &RimCellFilterCollection::onFilterUpdated );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
updateIconState();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
onFilterUpdated( nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellFilterCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
PdmObject::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
||||
|
||||
Rim3dView* rimView = nullptr;
|
||||
this->firstAncestorOrThisOfType( rimView );
|
||||
RimViewController* viewController = rimView->viewController();
|
||||
if ( viewController && ( viewController->isPropertyFilterOveridden() || viewController->isVisibleCellsOveridden() ) )
|
||||
{
|
||||
m_isActive.uiCapability()->setUiReadOnly( true, uiConfigName );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isActive.uiCapability()->setUiReadOnly( false, uiConfigName );
|
||||
}
|
||||
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::updateIconState()
|
||||
{
|
||||
bool activeIcon = true;
|
||||
|
||||
Rim3dView* rimView = nullptr;
|
||||
this->firstAncestorOrThisOfType( rimView );
|
||||
RimViewController* viewController = rimView->viewController();
|
||||
|
||||
bool isControlled = viewController &&
|
||||
( viewController->isCellFiltersControlled() || viewController->isVisibleCellsOveridden() );
|
||||
|
||||
if ( isControlled )
|
||||
{
|
||||
activeIcon = false;
|
||||
}
|
||||
|
||||
if ( !isActive() )
|
||||
{
|
||||
activeIcon = false;
|
||||
}
|
||||
|
||||
updateUiIconFromState( activeIcon );
|
||||
|
||||
for ( auto& filter : m_cellFilters )
|
||||
{
|
||||
filter->updateActiveState( isControlled );
|
||||
filter->updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::hasActiveFilters() const
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isActive() ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::hasActiveIncludeFilters() const
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isActive() && filter->filterMode() == RimCellFilter::INCLUDE ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineFilter* RimCellFilterCollection::addNewPolylineFilter( RimCase* srcCase )
|
||||
{
|
||||
RimPolylineFilter* pFilter = new RimPolylineFilter();
|
||||
pFilter->setCase( srcCase );
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
pFilter->setActive( false );
|
||||
|
||||
this->updateConnectedEditors();
|
||||
onFilterUpdated( pFilter );
|
||||
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedFilter* RimCellFilterCollection::addNewUserDefinedFilter( RimCase* srcCase )
|
||||
{
|
||||
RimUserDefinedFilter* pFilter = new RimUserDefinedFilter();
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
|
||||
this->updateConnectedEditors();
|
||||
onFilterUpdated( pFilter );
|
||||
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilter* RimCellFilterCollection::addNewCellRangeFilter( RimCase* srcCase, int sliceDirection, int defaultSlice )
|
||||
{
|
||||
RimCellRangeFilter* pFilter = new RimCellRangeFilter();
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
pFilter->setDefaultValues( sliceDirection, defaultSlice );
|
||||
|
||||
this->updateConnectedEditors();
|
||||
onFilterUpdated( pFilter );
|
||||
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
onFilterUpdated( nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::removeFilter( RimCellFilter* filter )
|
||||
{
|
||||
m_cellFilters.removeChildObject( filter );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::connectToFilterUpdates( RimCellFilter* filter )
|
||||
{
|
||||
filter->filterChanged.connect( this, &RimCellFilterCollection::onFilterUpdated );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::onFilterUpdated( const SignalEmitter* emitter )
|
||||
{
|
||||
Rim3dView* view = nullptr;
|
||||
firstAncestorOrThisOfType( view );
|
||||
if ( !view ) return;
|
||||
|
||||
if ( view->isMasterView() )
|
||||
{
|
||||
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||
if ( viewLinker )
|
||||
{
|
||||
viewLinker->updateCellFilters( dynamic_cast<const RimCellFilter*>( emitter ) );
|
||||
}
|
||||
}
|
||||
|
||||
view->scheduleGeometryRegen( VISIBLE_WELL_CELLS );
|
||||
view->scheduleGeometryRegen( RANGE_FILTERED );
|
||||
view->scheduleGeometryRegen( RANGE_FILTERED_INACTIVE );
|
||||
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Populate the given view filter with info from our filters
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const
|
||||
{
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
for ( RimCellFilter* filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isActive() && static_cast<size_t>( filter->gridIndex() ) == gridIndex )
|
||||
{
|
||||
filter->updateCompundFilter( cellRangeFilter );
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimCellFilter;
|
||||
class RimCellRangeFilter;
|
||||
class RimPolylineFilter;
|
||||
class RimUserDefinedFilter;
|
||||
class RimCase;
|
||||
class RigPolyLinesData;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class CellRangeFilter;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimCellFilterCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCellFilterCollection();
|
||||
~RimCellFilterCollection() override;
|
||||
|
||||
RimPolylineFilter* addNewPolylineFilter( RimCase* srcCase );
|
||||
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
||||
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int sliceDirection = -1, int defaultSlice = -1 );
|
||||
|
||||
void removeFilter( RimCellFilter* filter );
|
||||
|
||||
bool isEmpty() const;
|
||||
bool isActive() const;
|
||||
void setActive( bool bActive );
|
||||
|
||||
void compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const;
|
||||
|
||||
std::vector<RimCellFilter*> filters() const;
|
||||
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveIncludeFilters() const;
|
||||
|
||||
void updateIconState();
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
void connectToFilterUpdates( RimCellFilter* filter );
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void initAfterRead() override;
|
||||
void onFilterUpdated( const SignalEmitter* emitter );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimCellFilter*> m_cellFilters;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
caf::PdmChildArrayField<RimCellRangeFilter*> m_rangeFilters_OBSOLETE;
|
||||
};
|
@ -21,14 +21,10 @@
|
||||
#include "RimCellRangeFilter.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigReservoirGridTools.h"
|
||||
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimViewController.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
|
||||
@ -44,9 +40,6 @@ RimCellRangeFilter::RimCellRangeFilter()
|
||||
{
|
||||
CAF_PDM_InitObject( "Cell Range Filter", ":/CellFilter_Range.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid", "", "", "" );
|
||||
CAF_PDM_InitField( &propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &startIndexI, "StartIndexI", 1, "Start Index I", "", "", "" );
|
||||
startIndexI.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() );
|
||||
|
||||
@ -65,14 +58,6 @@ RimCellRangeFilter::RimCellRangeFilter()
|
||||
CAF_PDM_InitField( &cellCountK, "CellCountK", 1, "Cell Count K", "", "", "" );
|
||||
cellCountK.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_useIndividualCellIndices, "UseIndividualCellIndices", false, "Use Individual Cell Indices", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_individualCellIndices,
|
||||
"IndividualCellIndices",
|
||||
"Cell Indices",
|
||||
"",
|
||||
"Use Ctrl-C for copy and Ctrl-V for paste",
|
||||
"" );
|
||||
|
||||
updateIconState();
|
||||
setDeletable( true );
|
||||
}
|
||||
@ -84,22 +69,6 @@ RimCellRangeFilter::~RimCellRangeFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilter::setGridIndex( int gridIndex )
|
||||
{
|
||||
m_gridIndex = gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimCellRangeFilter::gridIndex() const
|
||||
{
|
||||
return m_gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -123,16 +92,15 @@ void RimCellRangeFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
startIndexK = 1;
|
||||
}
|
||||
|
||||
parentContainer()->updateDisplayModeNotifyManagedViews( this );
|
||||
|
||||
filterChanged.send();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( changedField != &name )
|
||||
if ( changedField != &m_name )
|
||||
{
|
||||
computeAndSetValidValues();
|
||||
|
||||
parentContainer()->updateDisplayModeNotifyManagedViews( this );
|
||||
filterChanged.send();
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,8 +109,6 @@ void RimCellRangeFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilter::computeAndSetValidValues()
|
||||
{
|
||||
CVF_ASSERT( parentContainer() );
|
||||
|
||||
const cvf::StructGridInterface* grid = selectedGrid();
|
||||
if ( grid && grid->cellCountI() > 0 && grid->cellCountJ() > 0 && grid->cellCountK() > 0 )
|
||||
{
|
||||
@ -161,34 +127,8 @@ void RimCellRangeFilter::computeAndSetValidValues()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilter::updateActiveState()
|
||||
void RimCellRangeFilter::setDefaultValues( int sliceDirection, int defaultSlice )
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly( isRangeFilterControlled() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilter::useIndividualCellIndices() const
|
||||
{
|
||||
return m_useIndividualCellIndices();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<cvf::Vec3d>& RimCellRangeFilter::individualCellIndices() const
|
||||
{
|
||||
return m_individualCellIndices.v();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilter::setDefaultValues()
|
||||
{
|
||||
CVF_ASSERT( parentContainer() );
|
||||
|
||||
const cvf::StructGridInterface* grid = selectedGrid();
|
||||
|
||||
if ( !grid ) return;
|
||||
@ -232,14 +172,24 @@ void RimCellRangeFilter::setDefaultValues()
|
||||
cellCountJ = static_cast<int>( grid->cellCountJ() );
|
||||
cellCountK = static_cast<int>( grid->cellCountK() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilterCollection* RimCellRangeFilter::parentContainer()
|
||||
{
|
||||
return dynamic_cast<RimCellRangeFilterCollection*>( this->parentField()->ownerObject() );
|
||||
switch ( sliceDirection )
|
||||
{
|
||||
case 0:
|
||||
cellCountI = 1;
|
||||
if ( defaultSlice > 0 ) startIndexI = defaultSlice;
|
||||
break;
|
||||
case 1:
|
||||
cellCountJ = 1;
|
||||
if ( defaultSlice > 0 ) startIndexJ = defaultSlice;
|
||||
break;
|
||||
case 2:
|
||||
cellCountK = 1;
|
||||
if ( defaultSlice > 0 ) startIndexK = defaultSlice;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -250,7 +200,7 @@ void RimCellRangeFilter::defineEditorAttribute( const caf::PdmFieldHandle* field
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
caf::PdmUiSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiSliderEditorAttribute*>( attribute );
|
||||
if ( !myAttr || !parentContainer() )
|
||||
if ( !myAttr )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -281,14 +231,7 @@ void RimCellRangeFilter::defineEditorAttribute( const caf::PdmFieldHandle* field
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
bool readOnlyState = isRangeFilterControlled();
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> objFields;
|
||||
this->fields( objFields );
|
||||
for ( auto& objField : objFields )
|
||||
{
|
||||
objField->uiCapability()->setUiReadOnly( readOnlyState );
|
||||
}
|
||||
RimCellFilter::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
const cvf::StructGridInterface* grid = selectedGrid();
|
||||
|
||||
@ -331,27 +274,15 @@ void RimCellRangeFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
cellCountK.uiCapability()->setUiName( QString( " Width" ) );
|
||||
}
|
||||
|
||||
uiOrdering.add( &name );
|
||||
uiOrdering.add( &filterMode );
|
||||
uiOrdering.add( &m_gridIndex );
|
||||
uiOrdering.add( &propagateToSubGrids );
|
||||
uiOrdering.add( &startIndexI );
|
||||
uiOrdering.add( &cellCountI );
|
||||
uiOrdering.add( &startIndexJ );
|
||||
uiOrdering.add( &cellCountJ );
|
||||
uiOrdering.add( &startIndexK );
|
||||
uiOrdering.add( &cellCountK );
|
||||
auto group = uiOrdering.addNewGroup( "Range Selection" );
|
||||
|
||||
if ( RiaApplication::enableDevelopmentFeatures() )
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( "Single Cell Filtering (TEST)" );
|
||||
group->setCollapsedByDefault( true );
|
||||
group->add( &startIndexI );
|
||||
group->add( &cellCountI );
|
||||
group->add( &startIndexJ );
|
||||
group->add( &cellCountJ );
|
||||
group->add( &startIndexK );
|
||||
group->add( &cellCountK );
|
||||
|
||||
group->add( &m_useIndividualCellIndices );
|
||||
group->add( &m_individualCellIndices );
|
||||
|
||||
m_individualCellIndices.uiCapability()->setUiReadOnly( !m_useIndividualCellIndices );
|
||||
}
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
@ -362,75 +293,35 @@ void RimCellRangeFilter::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrd
|
||||
{
|
||||
RimCellFilter::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
||||
|
||||
updateActiveState();
|
||||
updateActiveState( isFilterControlled() );
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellRangeFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
void RimCellRangeFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
if ( useOptionsOnly ) ( *useOptionsOnly ) = true;
|
||||
|
||||
if ( &m_gridIndex == fieldNeedingOptions )
|
||||
if ( filterMode() == RimCellFilter::INCLUDE )
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rimCase );
|
||||
|
||||
for ( int gIdx = 0; gIdx < RigReservoirGridTools::gridCount( rimCase ); ++gIdx )
|
||||
{
|
||||
QString gridName;
|
||||
|
||||
gridName += RigReservoirGridTools::gridName( rimCase, gIdx );
|
||||
if ( gIdx == 0 )
|
||||
{
|
||||
if ( gridName.isEmpty() )
|
||||
gridName += "Main Grid";
|
||||
else
|
||||
gridName += " (Main Grid)";
|
||||
}
|
||||
|
||||
caf::PdmOptionItemInfo item( gridName, (int)gIdx );
|
||||
options.push_back( item );
|
||||
}
|
||||
cellRangeFilter->addCellIncludeRange( static_cast<size_t>( startIndexI ) - 1,
|
||||
static_cast<size_t>( startIndexJ ) - 1,
|
||||
static_cast<size_t>( startIndexK ) - 1,
|
||||
static_cast<size_t>( startIndexI ) + cellCountI - 1,
|
||||
static_cast<size_t>( startIndexJ ) + cellCountJ - 1,
|
||||
static_cast<size_t>( startIndexK ) + cellCountK - 1,
|
||||
propagateToSubGrids() );
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilter::isRangeFilterControlled() const
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( rimView );
|
||||
|
||||
bool isRangeFilterControlled = false;
|
||||
if ( rimView && rimView->viewController() && rimView->viewController()->isRangeFiltersControlled() )
|
||||
else
|
||||
{
|
||||
isRangeFilterControlled = true;
|
||||
cellRangeFilter->addCellExcludeRange( static_cast<size_t>( startIndexI ) - 1,
|
||||
static_cast<size_t>( startIndexJ ) - 1,
|
||||
static_cast<size_t>( startIndexK ) - 1,
|
||||
static_cast<size_t>( startIndexI ) + cellCountI - 1,
|
||||
static_cast<size_t>( startIndexJ ) + cellCountJ - 1,
|
||||
static_cast<size_t>( startIndexK ) + cellCountK - 1,
|
||||
propagateToSubGrids() );
|
||||
}
|
||||
|
||||
return isRangeFilterControlled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const cvf::StructGridInterface* RimCellRangeFilter::selectedGrid()
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rimCase );
|
||||
|
||||
int clampedIndex = gridIndex();
|
||||
if ( clampedIndex >= RigReservoirGridTools::gridCount( rimCase ) )
|
||||
{
|
||||
clampedIndex = 0;
|
||||
}
|
||||
|
||||
return RigReservoirGridTools::gridByIndex( rimCase, clampedIndex );
|
||||
}
|
||||
|
@ -47,15 +47,7 @@ public:
|
||||
RimCellRangeFilter();
|
||||
~RimCellRangeFilter() override;
|
||||
|
||||
void setGridIndex( int gridIndex );
|
||||
int gridIndex() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_gridIndex; // The index of the grid that this filter applies to
|
||||
|
||||
public:
|
||||
caf::PdmField<bool> propagateToSubGrids; // Do propagate the effects to the sub-grids
|
||||
|
||||
caf::PdmField<int> startIndexI; // Eclipse indexing, first index is 1
|
||||
caf::PdmField<int> startIndexJ; // Eclipse indexing, first index is 1
|
||||
caf::PdmField<int> startIndexK; // Eclipse indexing, first index is 1
|
||||
@ -63,11 +55,9 @@ public:
|
||||
caf::PdmField<int> cellCountJ;
|
||||
caf::PdmField<int> cellCountK;
|
||||
|
||||
void setDefaultValues();
|
||||
void updateActiveState();
|
||||
void setDefaultValues( int sliceDirection = -1, int defaultSlice = -1 );
|
||||
|
||||
bool useIndividualCellIndices() const;
|
||||
const std::vector<cvf::Vec3d>& individualCellIndices() const;
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
@ -77,15 +67,6 @@ protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
RimCellRangeFilterCollection* parentContainer();
|
||||
bool isRangeFilterControlled() const;
|
||||
void computeAndSetValidValues();
|
||||
const cvf::StructGridInterface* selectedGrid();
|
||||
|
||||
caf::PdmField<bool> m_useIndividualCellIndices;
|
||||
caf::PdmField<std::vector<cvf::Vec3d>> m_individualCellIndices;
|
||||
void computeAndSetValidValues();
|
||||
};
|
||||
|
@ -22,8 +22,12 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class Rim3dView;
|
||||
class RimCellFilter;
|
||||
class RimCellRangeFilter;
|
||||
class RimPolylineFilter;
|
||||
class RimUserDefinedFilter;
|
||||
class RimCase;
|
||||
class RigPolyLinesData;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -34,34 +38,48 @@ class CellRangeFilter;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimCellRangeFilterCollection : public caf::PdmObject
|
||||
class RimCellFilterCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCellRangeFilterCollection();
|
||||
~RimCellRangeFilterCollection() override;
|
||||
RimCellFilterCollection();
|
||||
~RimCellFilterCollection() override;
|
||||
|
||||
// Fields
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmChildArrayField<RimCellRangeFilter*> rangeFilters;
|
||||
RimPolylineFilter* addNewPolylineFilter( RimCase* srcCase );
|
||||
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
||||
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int sliceDirection = -1, int defaultSlice = -1 );
|
||||
|
||||
void removeFilter( RimCellFilter* filter );
|
||||
|
||||
bool isEmpty() const;
|
||||
bool isActive() const;
|
||||
void setActive( bool bActive );
|
||||
|
||||
// Methods
|
||||
void compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const;
|
||||
|
||||
std::vector<RimCellFilter*> filters() const;
|
||||
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveIncludeFilters() const;
|
||||
|
||||
void updateDisplayModeNotifyManagedViews( RimCellRangeFilter* changedRangeFilter );
|
||||
void updateIconState();
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
void connectToFilterUpdates( RimCellFilter* filter );
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void initAfterRead() override;
|
||||
void onFilterUpdated( const SignalEmitter* emitter );
|
||||
|
||||
private:
|
||||
Rim3dView* baseView() const;
|
||||
caf::PdmChildArrayField<RimCellFilter*> m_cellFilters;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
caf::PdmChildArrayField<RimCellRangeFilter*> m_rangeFilters_OBSOLETE;
|
||||
};
|
||||
|
@ -150,8 +150,8 @@ void RimEclipsePropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
if ( &m_lowerBound == changedField
|
||||
|| &m_upperBound == changedField
|
||||
|| &obsoleteField_evaluationRegion == changedField
|
||||
|| &isActive == changedField
|
||||
|| &filterMode == changedField
|
||||
|| &m_isActive == changedField
|
||||
|| &m_filterMode == changedField
|
||||
|| &m_selectedCategoryValues == changedField
|
||||
|| &m_useCategorySelection == changedField)
|
||||
{
|
||||
@ -199,7 +199,7 @@ void RimEclipsePropertyFilter::setToDefaultValues()
|
||||
void RimEclipsePropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
// Fields declared in RimCellFilter
|
||||
uiOrdering.add( &name );
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
// Fields declared in Rimm_resultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
|
||||
@ -208,7 +208,7 @@ void RimEclipsePropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
caf::PdmUiGroup& group2 = *( uiOrdering.addNewGroup( "Filter Settings" ) );
|
||||
|
||||
// Fields declared in RimCellFilter
|
||||
group2.add( &filterMode );
|
||||
group2.add( &m_filterMode );
|
||||
|
||||
group2.add( &m_rangeLabelText );
|
||||
|
||||
@ -329,7 +329,7 @@ void RimEclipsePropertyFilter::setCategoriesFromTracerNames( const std::vector<Q
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::updateActiveState()
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly( isPropertyFilterControlled() );
|
||||
m_isActive.uiCapability()->setUiReadOnly( isPropertyFilterControlled() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -519,7 +519,7 @@ void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
|
||||
m_upperBound.uiCapability()->updateConnectedEditors();
|
||||
|
||||
updateFilterName();
|
||||
this->name.uiCapability()->updateConnectedEditors();
|
||||
m_name.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -563,7 +563,7 @@ void RimEclipsePropertyFilter::updateFilterName()
|
||||
newFiltername += " (" + QString::number( m_lowerBound ) + " .. " + QString::number( m_upperBound ) + ")";
|
||||
}
|
||||
|
||||
this->name = newFiltername;
|
||||
m_name = newFiltername;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -80,8 +80,8 @@ void RimGeoMechPropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( &lowerBound == changedField || &upperBound == changedField || &isActive == changedField ||
|
||||
&filterMode == changedField || &m_selectedCategoryValues == changedField )
|
||||
if ( &lowerBound == changedField || &upperBound == changedField || &m_isActive == changedField ||
|
||||
&m_filterMode == changedField || &m_selectedCategoryValues == changedField )
|
||||
{
|
||||
this->updateIconState();
|
||||
this->updateFilterName();
|
||||
@ -129,14 +129,14 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &name );
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
|
||||
resultDefinition->uiOrdering( uiConfigName, *group1 );
|
||||
|
||||
caf::PdmUiGroup& group2 = *( uiOrdering.addNewGroup( "Filter Settings" ) );
|
||||
|
||||
group2.add( &filterMode );
|
||||
group2.add( &m_filterMode );
|
||||
|
||||
if ( resultDefinition->hasCategoryResult() )
|
||||
{
|
||||
@ -211,7 +211,7 @@ bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::updateActiveState()
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly( isPropertyFilterControlled() );
|
||||
m_isActive.uiCapability()->setUiReadOnly( isPropertyFilterControlled() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -324,7 +324,7 @@ void RimGeoMechPropertyFilter::updateFilterName()
|
||||
" .. " + QString::number( upperBound ) + ")";
|
||||
}
|
||||
|
||||
this->name = newFiltername;
|
||||
m_name = newFiltername;
|
||||
|
||||
uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
@ -0,0 +1,641 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RimPolylineFilter.h"
|
||||
|
||||
#include "RigCellGeometryTools.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartGrid.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigPolyLinesData.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
|
||||
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimPolylineFilter::PolylineFilterModeType>::setUp()
|
||||
{
|
||||
addItem( RimPolylineFilter::PolylineFilterModeType::DEPTH_Z, "DEPTH_Z", "Depth" );
|
||||
addItem( RimPolylineFilter::PolylineFilterModeType::INDEX_K, "INDEX_K", "K index" );
|
||||
setDefault( RimPolylineFilter::PolylineFilterModeType::INDEX_K );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimPolylineFilter::PolylineIncludeType>::setUp()
|
||||
{
|
||||
addItem( RimPolylineFilter::PolylineIncludeType::FULL_CELL, "FULL_CELL", "Whole cell inside polygon" );
|
||||
addItem( RimPolylineFilter::PolylineIncludeType::CENTER, "CENTER", "Cell center inside polygon" );
|
||||
addItem( RimPolylineFilter::PolylineIncludeType::ANY, "ANY", "Any corner inside polygon" );
|
||||
setDefault( RimPolylineFilter::PolylineIncludeType::CENTER );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPolylineFilter, "PolyLineFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineFilter::RimPolylineFilter()
|
||||
: m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
{
|
||||
CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polyline.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_polyFilterMode, "PolylineFilterType", "Depth Type", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_polyIncludeType, "PolyIncludeType", "Cells to include", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_enablePicking );
|
||||
m_enablePicking.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::HIDDEN );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets", "", "", "" );
|
||||
m_targets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_targets.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_targets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_targets.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_srcCase, "Case", "Case", "", "", "" );
|
||||
m_srcCase.uiCapability()->setUiHidden( true );
|
||||
|
||||
this->setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
updateIconState();
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineFilter::~RimPolylineFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateVisualization()
|
||||
{
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::initAfterRead()
|
||||
{
|
||||
resolveReferencesRecursively();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateEditorsAndVisualization()
|
||||
{
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::setCase( RimCase* srcCase )
|
||||
{
|
||||
m_srcCase = srcCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylineTarget*> RimPolylineFilter::activeTargets() const
|
||||
{
|
||||
return m_targets.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert )
|
||||
{
|
||||
size_t index = m_targets.index( targetToInsertBefore );
|
||||
if ( index < m_targets.size() )
|
||||
m_targets.insert( index, targetToInsert );
|
||||
else
|
||||
m_targets.push_back( targetToInsert );
|
||||
|
||||
updateCells();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_enablePicking )
|
||||
{
|
||||
auto* pbAttribute = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( pbAttribute )
|
||||
{
|
||||
if ( !m_enablePicking )
|
||||
{
|
||||
pbAttribute->m_buttonText = "Start Picking Points";
|
||||
}
|
||||
else
|
||||
{
|
||||
pbAttribute->m_buttonText = "Stop Picking Points";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( field == &m_targets )
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
|
||||
if ( tvAttribute )
|
||||
{
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
|
||||
|
||||
if ( m_enablePicking )
|
||||
{
|
||||
tvAttribute->baseColor.setRgb( 255, 220, 255 );
|
||||
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimCellFilter::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
uiOrdering.add( &m_polyFilterMode );
|
||||
uiOrdering.add( &m_polyIncludeType );
|
||||
uiOrdering.add( &m_targets );
|
||||
uiOrdering.add( &m_enablePicking );
|
||||
|
||||
m_polyIncludeType.uiCapability()->setUiName( "Cells to " + modeString() );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_enablePicking )
|
||||
{
|
||||
this->updateConnectedEditors();
|
||||
|
||||
if ( m_enablePicking() )
|
||||
{
|
||||
setActive( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
setActive( true );
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
}
|
||||
}
|
||||
else if ( changedField != &m_name )
|
||||
{
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
this->updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::enablePicking( bool enable )
|
||||
{
|
||||
m_enablePicking = enable;
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylineFilter::pickingEnabled() const
|
||||
{
|
||||
return m_enablePicking();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PickEventHandler* RimPolylineFilter::pickEventHandler() const
|
||||
{
|
||||
return m_pickTargetsEventHandler.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter )
|
||||
{
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
if ( m_cells.size() == 0 ) updateCells();
|
||||
|
||||
const auto grid = selectedGrid();
|
||||
size_t i, j, k;
|
||||
|
||||
for ( size_t cellidx : m_cells )
|
||||
{
|
||||
grid->ijkFromCellIndex( cellidx, &i, &j, &k );
|
||||
if ( this->filterMode() == RimCellFilter::INCLUDE )
|
||||
{
|
||||
cellRangeFilter->addCellInclude( i, j, k, propagateToSubGrids() );
|
||||
}
|
||||
else
|
||||
{
|
||||
cellRangeFilter->addCellExclude( i, j, k, propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylineFilter::cellInsidePolygon2D( cvf::Vec3d center,
|
||||
std::array<cvf::Vec3d, 8>& corners,
|
||||
std::vector<cvf::Vec3d> polygon )
|
||||
{
|
||||
bool bInside = false;
|
||||
switch ( m_polyIncludeType() )
|
||||
{
|
||||
case PolylineIncludeType::ANY:
|
||||
// any part of the cell is inside
|
||||
for ( const auto& point : corners )
|
||||
{
|
||||
if ( RigCellGeometryTools::pointInsidePolygon2D( point, polygon ) ) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case PolylineIncludeType::CENTER:
|
||||
// cell center is inside
|
||||
return RigCellGeometryTools::pointInsidePolygon2D( center, polygon );
|
||||
|
||||
case PolylineIncludeType::FULL_CELL:
|
||||
// entire cell is inside
|
||||
bInside = true;
|
||||
for ( const auto& point : corners )
|
||||
{
|
||||
bInside = bInside && RigCellGeometryTools::pointInsidePolygon2D( point, polygon );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return bInside;
|
||||
}
|
||||
|
||||
void RimPolylineFilter::updateCellsDepthEclipse( const std::vector<cvf::Vec3d>& points, const RigMainGrid* grid )
|
||||
{
|
||||
// we should look in depth using Z coordinate
|
||||
// loop over all cells
|
||||
for ( size_t i = 0; i < grid->cellCount(); i++ )
|
||||
{
|
||||
// valid cell?
|
||||
RigCell cell = grid->cellByGridAndGridLocalCellIdx( gridIndex(), i );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
// get corner coordinates
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
grid->cellCornerVertices( i, hexCorners.data() );
|
||||
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( cell.center(), hexCorners, points ) )
|
||||
{
|
||||
m_cells.push_back( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// we should look in depth using the K coordinate
|
||||
// 1. find the K layer of the first point
|
||||
// 2. find all cells in this K layer that matches the selection criteria
|
||||
// 3. extend those cells to all K layers
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsKIndexEclipse( const std::vector<cvf::Vec3d>& points, const RigMainGrid* grid )
|
||||
{
|
||||
// we need to find the K layer we hit with the first point
|
||||
size_t ni, nj, nk;
|
||||
// move the point a bit downwards to make sure it is inside something
|
||||
cvf::Vec3d point = points[0];
|
||||
point.z() += 0.2;
|
||||
|
||||
bool cellFound = false;
|
||||
|
||||
// loop over all points to find at least one point with a valid K layer
|
||||
for ( size_t p = 0; p < points.size() - 1; p++ )
|
||||
{
|
||||
// loop over all cells to find the correct one
|
||||
for ( size_t i = 0; i < grid->cellCount(); i++ )
|
||||
{
|
||||
// valid cell?
|
||||
RigCell cell = grid->cellByGridAndGridLocalCellIdx( gridIndex(), i );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
// is the point inside?
|
||||
cvf::BoundingBox bb = cell.boundingBox();
|
||||
if ( !bb.contains( points[p] ) ) continue;
|
||||
|
||||
// found the cell, get the IJK
|
||||
grid->ijkFromCellIndexUnguarded( cell.mainGridCellIndex(), &ni, &nj, &nk );
|
||||
cellFound = true;
|
||||
break;
|
||||
}
|
||||
if ( cellFound ) break;
|
||||
}
|
||||
|
||||
// should not really happen, but just to be sure
|
||||
if ( !cellFound ) return;
|
||||
|
||||
std::list<size_t> foundCells;
|
||||
|
||||
// find all cells in this K layer that matches the polygon
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
size_t cellIdx = grid->cellIndexFromIJK( i, j, nk );
|
||||
RigCell cell = grid->cellByGridAndGridLocalCellIdx( gridIndex(), cellIdx );
|
||||
// valid cell?
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
// get corner coordinates
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
grid->cellCornerVertices( cellIdx, hexCorners.data() );
|
||||
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( cell.center(), hexCorners, points ) )
|
||||
{
|
||||
foundCells.push_back( cellIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now extend all these cells in one K layer to all K layers
|
||||
for ( const size_t cellIdx : foundCells )
|
||||
{
|
||||
size_t ci, cj, ck;
|
||||
grid->ijkFromCellIndexUnguarded( cellIdx, &ci, &cj, &ck );
|
||||
|
||||
for ( size_t k = 0; k < grid->cellCountK(); k++ )
|
||||
{
|
||||
// get the cell index
|
||||
size_t newIdx = grid->cellIndexFromIJK( ci, cj, k );
|
||||
// valid cell?
|
||||
RigCell cell = grid->cellByGridAndGridLocalCellIdx( gridIndex(), newIdx );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
m_cells.push_back( newIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsForEclipse( const std::vector<cvf::Vec3d>& points, RimEclipseCase* eCase )
|
||||
{
|
||||
RigEclipseCaseData* data = eCase->eclipseCaseData();
|
||||
if ( !data ) return;
|
||||
|
||||
RigMainGrid* grid = data->mainGrid();
|
||||
if ( !grid ) return;
|
||||
|
||||
if ( m_polyFilterMode == PolylineFilterModeType::DEPTH_Z )
|
||||
{
|
||||
updateCellsDepthEclipse( points, grid );
|
||||
}
|
||||
else if ( m_polyFilterMode == PolylineFilterModeType::INDEX_K )
|
||||
{
|
||||
updateCellsKIndexEclipse( points, grid );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>& points, const RigFemPartGrid* grid )
|
||||
{
|
||||
// we should look in depth using Z coordinate
|
||||
// loop over all cells
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
for ( size_t k = 0; k < grid->cellCountK(); k++ )
|
||||
{
|
||||
size_t cellIdx = grid->cellIndexFromIJK( i, j, k );
|
||||
|
||||
cvf::Vec3d vertices[8];
|
||||
grid->cellCornerVertices( cellIdx, vertices );
|
||||
cvf::Vec3d center = grid->cellCentroid( cellIdx );
|
||||
|
||||
std::array<cvf::Vec3d, 8> corners;
|
||||
for ( size_t n = 0; n < 8; n++ )
|
||||
corners[n] = vertices[n];
|
||||
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( center, corners, points ) )
|
||||
{
|
||||
m_cells.push_back( cellIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
// we should look in depth using the K coordinate
|
||||
// 1. find the K layer of the first point
|
||||
// 2. find all cells in this K layer that matches the selection criteria
|
||||
// 3. extend those cells to all K layers
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsKIndexGeoMech( const std::vector<cvf::Vec3d>& points, const RigFemPartGrid* grid )
|
||||
{
|
||||
// we need to find the K layer we hit with the first point
|
||||
size_t nk;
|
||||
// move the point a bit downwards to make sure it is inside something
|
||||
cvf::Vec3d point = points[0];
|
||||
point.z() += 0.2;
|
||||
|
||||
bool cellFound = false;
|
||||
// loop over all cells to find the correct one
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
for ( size_t k = 0; k < grid->cellCountK(); k++ )
|
||||
{
|
||||
// get cell bounding box
|
||||
size_t cellIdx = grid->cellIndexFromIJK( i, j, k );
|
||||
cvf::BoundingBox bb;
|
||||
cvf::Vec3d vertices[8];
|
||||
grid->cellCornerVertices( cellIdx, vertices );
|
||||
for ( const auto& point : vertices )
|
||||
bb.add( point );
|
||||
|
||||
// check all points for a bb match
|
||||
for ( size_t p = 0; p < points.size() - 1; p++ )
|
||||
{
|
||||
// is the point inside?
|
||||
if ( bb.contains( points[p] ) )
|
||||
{
|
||||
cellFound = true;
|
||||
// found the cell, store the K
|
||||
nk = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cellFound ) break;
|
||||
}
|
||||
if ( cellFound ) break;
|
||||
}
|
||||
if ( cellFound ) break;
|
||||
}
|
||||
|
||||
// should not really happen, but just to be sure
|
||||
if ( !cellFound ) return;
|
||||
|
||||
// find all cells in this K layer that matches the polygon
|
||||
std::list<size_t> foundCells;
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
size_t cellIdx = grid->cellIndexFromIJK( i, j, nk );
|
||||
|
||||
// get corner coordinates
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
grid->cellCornerVertices( cellIdx, hexCorners.data() );
|
||||
cvf::Vec3d center = grid->cellCentroid( cellIdx );
|
||||
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( center, hexCorners, points ) )
|
||||
{
|
||||
foundCells.push_back( cellIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now extend all these cells in one K layer to all K layers
|
||||
for ( const size_t cellIdx : foundCells )
|
||||
{
|
||||
size_t ci, cj, ck;
|
||||
grid->ijkFromCellIndex( cellIdx, &ci, &cj, &ck );
|
||||
|
||||
for ( size_t k = 0; k < grid->cellCountK(); k++ )
|
||||
{
|
||||
// get the cell index
|
||||
size_t newIdx = grid->cellIndexFromIJK( ci, cj, k );
|
||||
m_cells.push_back( newIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsForGeoMech( const std::vector<cvf::Vec3d>& points, RimGeoMechCase* gCase )
|
||||
{
|
||||
if ( gCase->geoMechData() && gCase->geoMechData()->femParts()->partCount() > 0 )
|
||||
{
|
||||
const RigFemPartGrid* grid = gCase->geoMechData()->femParts()->part( 0 )->getOrCreateStructGrid();
|
||||
|
||||
if ( m_polyFilterMode == PolylineFilterModeType::DEPTH_Z )
|
||||
{
|
||||
updateCellsDepthGeoMech( points, grid );
|
||||
}
|
||||
else if ( m_polyFilterMode == PolylineFilterModeType::INDEX_K )
|
||||
{
|
||||
updateCellsKIndexGeoMech( points, grid );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Update the cell index list with the cells that are inside our polygon, if any
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCells()
|
||||
{
|
||||
// reset
|
||||
m_cells.clear();
|
||||
|
||||
// get polyline as vector
|
||||
std::vector<cvf::Vec3d> points;
|
||||
for ( auto& target : m_targets )
|
||||
{
|
||||
if ( target->isEnabled() ) points.push_back( target->targetPointXYZ() );
|
||||
}
|
||||
|
||||
// We need at least three points to make a sensible polygon
|
||||
if ( points.size() < 3 ) return;
|
||||
|
||||
// make sure first and last point is the same (req. by polygon methods later)
|
||||
points.push_back( points.front() );
|
||||
|
||||
RimEclipseCase* eCase = dynamic_cast<RimEclipseCase*>( m_srcCase() );
|
||||
RimGeoMechCase* gCase = dynamic_cast<RimGeoMechCase*>( m_srcCase() );
|
||||
|
||||
if ( eCase )
|
||||
{
|
||||
updateCellsForEclipse( points, eCase );
|
||||
}
|
||||
else if ( gCase )
|
||||
{
|
||||
updateCellsForGeoMech( points, gCase );
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RimCellFilter.h"
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafPickEventHandler.h"
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
class RicPolylineTargetsPickEventHandler;
|
||||
class RimPolylineTarget;
|
||||
class RimCase;
|
||||
class RimEclipseCase;
|
||||
class RimGeoMechCase;
|
||||
class RigMainGrid;
|
||||
class RigFemPartGrid;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylineFilter : public RimCellFilter, public RimPolylinePickerInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class PolylineFilterModeType
|
||||
{
|
||||
DEPTH_Z,
|
||||
INDEX_K
|
||||
};
|
||||
|
||||
enum class PolylineIncludeType
|
||||
{
|
||||
FULL_CELL,
|
||||
CENTER,
|
||||
ANY
|
||||
};
|
||||
|
||||
RimPolylineFilter();
|
||||
~RimPolylineFilter() override;
|
||||
|
||||
void setCase( RimCase* srcCase );
|
||||
|
||||
void updateVisualization() override;
|
||||
void updateEditorsAndVisualization() override;
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
|
||||
void enablePicking( bool enable );
|
||||
|
||||
std::vector<RimPolylineTarget*> activeTargets() const override;
|
||||
bool pickingEnabled() const override;
|
||||
caf::PickEventHandler* pickEventHandler() const override;
|
||||
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void updateCells();
|
||||
void updateCellsForEclipse( const std::vector<cvf::Vec3d>& points, RimEclipseCase* eCase );
|
||||
void updateCellsForGeoMech( const std::vector<cvf::Vec3d>& points, RimGeoMechCase* gCase );
|
||||
|
||||
void updateCellsDepthEclipse( const std::vector<cvf::Vec3d>& points, const RigMainGrid* grid );
|
||||
void updateCellsKIndexEclipse( const std::vector<cvf::Vec3d>& points, const RigMainGrid* grid );
|
||||
void updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>& points, const RigFemPartGrid* grid );
|
||||
void updateCellsKIndexGeoMech( const std::vector<cvf::Vec3d>& points, const RigFemPartGrid* grid );
|
||||
|
||||
bool cellInsidePolygon2D( cvf::Vec3d center, std::array<cvf::Vec3d, 8>& corners, std::vector<cvf::Vec3d> polygon );
|
||||
|
||||
caf::PdmField<bool> m_enablePicking;
|
||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||
caf::PdmField<caf::AppEnum<PolylineFilterModeType>> m_polyFilterMode;
|
||||
caf::PdmField<caf::AppEnum<PolylineIncludeType>> m_polyIncludeType;
|
||||
caf::PdmPtrField<RimCase*> m_srcCase;
|
||||
|
||||
std::shared_ptr<RicPolylineTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||
|
||||
std::list<size_t> m_cells;
|
||||
};
|
@ -34,6 +34,8 @@ public:
|
||||
|
||||
std::vector<int> selectedCategoryValues() const;
|
||||
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) override{};
|
||||
|
||||
protected:
|
||||
void setCategoryValues( const std::vector<int>& categoryValues );
|
||||
void setCategoryNames( const std::vector<QString>& categoryNames );
|
||||
|
@ -0,0 +1,97 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RimUserDefinedFilter.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimUserDefinedFilter, "UserDefinedFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedFilter::RimUserDefinedFilter()
|
||||
{
|
||||
CAF_PDM_InitObject( "User Defined Filter", ":/CellFilter_UserDefined.png", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_individualCellIndices,
|
||||
"IndividualCellIndices",
|
||||
"Cells",
|
||||
"",
|
||||
"Use Ctrl-C for copy and Ctrl-V for paste",
|
||||
"" );
|
||||
|
||||
updateIconState();
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedFilter::~RimUserDefinedFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimCellFilter::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
auto group = uiOrdering.addNewGroup( QString( "Cell Indexes (I J K) to " ) + modeString() );
|
||||
group->setCollapsedByDefault( false );
|
||||
group->add( &m_individualCellIndices );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField != &m_name )
|
||||
{
|
||||
filterChanged.send();
|
||||
updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter )
|
||||
{
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
if ( this->filterMode() == RimCellFilter::INCLUDE )
|
||||
{
|
||||
for ( const auto& cellIndex : m_individualCellIndices() )
|
||||
{
|
||||
cellRangeFilter->addCellInclude( cellIndex.x() - 1, cellIndex.y() - 1, cellIndex.z() - 1, propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( const auto& cellIndex : m_individualCellIndices() )
|
||||
{
|
||||
cellRangeFilter->addCellExclude( cellIndex.x() - 1, cellIndex.y() - 1, cellIndex.z() - 1, propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2020 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
|
||||
@ -19,25 +18,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimCellRangeFilter;
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterInsertFeature : public caf::CmdFeature
|
||||
class RimUserDefinedFilter : public RimCellFilter
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimUserDefinedFilter();
|
||||
~RimUserDefinedFilter() override;
|
||||
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) override;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
static std::vector<RimCellRangeFilter*> selectedCellRangeFilters();
|
||||
caf::PdmField<std::vector<cvf::Vec3d>> m_individualCellIndices;
|
||||
};
|
@ -602,7 +602,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
|
||||
for ( RimEclipsePropertyFilter* f : view->eclipsePropertyFilterCollection()->propertyFilters() )
|
||||
{
|
||||
f->isActive = false;
|
||||
f->setActive( false );
|
||||
}
|
||||
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter( view->eclipsePropertyFilterCollection() );
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMeasurement.h"
|
||||
|
@ -37,8 +37,8 @@
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimColorLegend.h"
|
||||
#include "RimColorLegendCollection.h"
|
||||
#include "RimColorLegendItem.h"
|
||||
@ -304,20 +304,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicSaveEclipseInputPropertyFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimCellRangeFilterCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicRangeFilterNewFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceIFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceJFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceKFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimCellRangeFilter*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicRangeFilterInsertFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceIFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceJFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceKFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipsePropertyFilterCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicEclipsePropertyFilterNewFeature";
|
||||
@ -966,6 +952,18 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicCopySurfaceFeature";
|
||||
menuBuilder << "RicReloadSurfaceFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimCellFilterCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewPolylineFilterFeature";
|
||||
menuBuilder << "RicNewUserDefinedFilterFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewCellRangeFilterFeature";
|
||||
menuBuilder.subMenuStart( "Slice Filters" );
|
||||
menuBuilder << "RicNewRangeFilterSliceIFeature";
|
||||
menuBuilder << "RicNewRangeFilterSliceJFeature";
|
||||
menuBuilder << "RicNewRangeFilterSliceKFeature";
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
else if ( dynamic_cast<RimAnnotationCollection*>( firstUiItem ) ||
|
||||
dynamic_cast<RimAnnotationGroupCollection*>( firstUiItem ) )
|
||||
{
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "RigHexIntersectionTools.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapProjection.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
@ -218,7 +218,7 @@ void RimEclipseContourMapView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
|
||||
uiTreeOrdering.add( wellCollection() );
|
||||
uiTreeOrdering.add( faultCollection() );
|
||||
uiTreeOrdering.add( annotationCollection() );
|
||||
uiTreeOrdering.add( m_rangeFilterCollection() );
|
||||
uiTreeOrdering.add( m_cellFilterCollection() );
|
||||
uiTreeOrdering.add( nativePropertyFilterCollection() );
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren();
|
||||
@ -423,7 +423,7 @@ void RimEclipseContourMapView::updateViewWidgetAfterCreation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseContourMapView::updateViewFollowingRangeFilterUpdates()
|
||||
void RimEclipseContourMapView::updateViewFollowingCellFilterUpdates()
|
||||
{
|
||||
m_contourMapProjection->setCheckState( true );
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
void appendPickPointVisToModel();
|
||||
void onUpdateLegends() override;
|
||||
void updateViewWidgetAfterCreation() override;
|
||||
void updateViewFollowingRangeFilterUpdates() override;
|
||||
void updateViewFollowingCellFilterUpdates() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
@ -373,7 +373,7 @@ void RimEclipseView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( changedField == &m_rangeFilterCollection )
|
||||
else if ( changedField == &m_cellFilterCollection )
|
||||
{
|
||||
this->scheduleGeometryRegen( RANGE_FILTERED );
|
||||
this->scheduleGeometryRegen( RANGE_FILTERED_INACTIVE );
|
||||
@ -484,7 +484,7 @@ void RimEclipseView::onCreateDisplayModel()
|
||||
{
|
||||
geometryTypesToAdd.push_back( OVERRIDDEN_CELL_VISIBILITY );
|
||||
}
|
||||
else if ( this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
else if ( this->cellFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED );
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
@ -495,12 +495,12 @@ void RimEclipseView::onCreateDisplayModel()
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
|
||||
}
|
||||
}
|
||||
else if ( !this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
else if ( !this->cellFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS );
|
||||
}
|
||||
else if ( this->rangeFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells() )
|
||||
else if ( this->cellFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED );
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
@ -789,8 +789,8 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
|
||||
|
||||
if ( this->showInactiveCells() )
|
||||
{
|
||||
if ( this->rangeFilterCollection()->hasActiveFilters() ) // Wells not considered, because we do not have a
|
||||
// INACTIVE_WELL_CELLS group yet.
|
||||
if ( this->cellFilterCollection()->hasActiveFilters() ) // Wells not considered, because we do not have a
|
||||
// INACTIVE_WELL_CELLS group yet.
|
||||
{
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel( frameParts.p(),
|
||||
RANGE_FILTERED_INACTIVE,
|
||||
@ -824,19 +824,19 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
else if ( this->cellFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometriesToRecolor.push_back( RANGE_FILTERED );
|
||||
geometriesToRecolor.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
geometriesToRecolor.push_back( VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
geometriesToRecolor.push_back( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
}
|
||||
else if ( !this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
else if ( !this->cellFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometriesToRecolor.push_back( VISIBLE_WELL_CELLS );
|
||||
geometriesToRecolor.push_back( VISIBLE_WELL_FENCE_CELLS );
|
||||
}
|
||||
else if ( this->rangeFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells() )
|
||||
else if ( this->cellFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometriesToRecolor.push_back( RANGE_FILTERED );
|
||||
geometriesToRecolor.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
@ -1898,7 +1898,7 @@ void RimEclipseView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
|
||||
if ( surfaceInViewCollection() ) uiTreeOrdering.add( surfaceInViewCollection() );
|
||||
|
||||
uiTreeOrdering.add( m_rangeFilterCollection() );
|
||||
uiTreeOrdering.add( cellFilterCollection() );
|
||||
uiTreeOrdering.add( m_propertyFilterCollection() );
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
@ -2249,8 +2249,8 @@ bool RimEclipseView::isShowingActiveCellsOnly()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::updateIconStateForFilterCollections()
|
||||
{
|
||||
m_rangeFilterCollection()->updateIconState();
|
||||
m_rangeFilterCollection()->uiCapability()->updateConnectedEditors();
|
||||
m_cellFilterCollection()->updateIconState();
|
||||
m_cellFilterCollection()->uiCapability()->updateConnectedEditors();
|
||||
|
||||
// NB - notice that it is the filter collection managed by this view that the icon update applies to
|
||||
m_propertyFilterCollection()->updateIconState();
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigHexIntersectionTools.h"
|
||||
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@ -152,10 +152,10 @@ cvf::ref<cvf::UByteArray> RimGeoMechContourMapProjection::getCellVisibility() co
|
||||
cvf::ref<cvf::UByteArray> cellGridIdxVisibility = new cvf::UByteArray( m_femPart->elementCount() );
|
||||
RivFemElmVisibilityCalculator::computeAllVisible( cellGridIdxVisibility.p(), m_femPart.p() );
|
||||
|
||||
if ( view()->rangeFilterCollection()->isActive() )
|
||||
if ( view()->cellFilterCollection()->isActive() )
|
||||
{
|
||||
cvf::CellRangeFilter cellRangeFilter;
|
||||
view()->rangeFilterCollection()->compoundCellRangeFilter( &cellRangeFilter, 0 );
|
||||
view()->cellFilterCollection()->compoundCellRangeFilter( &cellRangeFilter, 0 );
|
||||
RivFemElmVisibilityCalculator::computeRangeVisibility( cellGridIdxVisibility.p(), m_femPart.p(), cellRangeFilter );
|
||||
}
|
||||
if ( view()->propertyFilterCollection()->isActive() )
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechContourMapProjection.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@ -228,7 +228,7 @@ void RimGeoMechContourMapView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
|
||||
uiTreeOrdering.add( m_contourMapProjection );
|
||||
uiTreeOrdering.add( cellResult() );
|
||||
cellResult()->uiCapability()->setUiReadOnly( m_contourMapProjection->isColumnResult() );
|
||||
uiTreeOrdering.add( m_rangeFilterCollection() );
|
||||
uiTreeOrdering.add( m_cellFilterCollection() );
|
||||
uiTreeOrdering.add( nativePropertyFilterCollection() );
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren();
|
||||
@ -414,7 +414,7 @@ void RimGeoMechContourMapView::updateViewWidgetAfterCreation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechContourMapView::updateViewFollowingRangeFilterUpdates()
|
||||
void RimGeoMechContourMapView::updateViewFollowingCellFilterUpdates()
|
||||
{
|
||||
m_contourMapProjection->setCheckState( true );
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
|
@ -56,7 +56,7 @@ protected:
|
||||
void appendPickPointVisToModel();
|
||||
void onUpdateLegends() override;
|
||||
void updateViewWidgetAfterCreation() override;
|
||||
void updateViewFollowingRangeFilterUpdates() override;
|
||||
void updateViewFollowingCellFilterUpdates() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@ -907,8 +907,8 @@ void RimGeoMechView::calculateCurrentTotalCellVisibility( cvf::UByteArray* total
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::updateIconStateForFilterCollections()
|
||||
{
|
||||
m_rangeFilterCollection()->updateIconState();
|
||||
m_rangeFilterCollection()->uiCapability()->updateConnectedEditors();
|
||||
m_cellFilterCollection()->updateIconState();
|
||||
m_cellFilterCollection()->uiCapability()->updateConnectedEditors();
|
||||
|
||||
// NB - notice that it is the filter collection managed by this view that the icon update applies to
|
||||
m_propertyFilterCollection()->updateIconState();
|
||||
@ -965,7 +965,7 @@ void RimGeoMechView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
uiTreeOrdering.add( m_intersectionCollection() );
|
||||
if ( surfaceInViewCollection() ) uiTreeOrdering.add( surfaceInViewCollection() );
|
||||
|
||||
uiTreeOrdering.add( m_rangeFilterCollection() );
|
||||
uiTreeOrdering.add( m_cellFilterCollection() );
|
||||
uiTreeOrdering.add( m_propertyFilterCollection() );
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
@ -59,18 +59,14 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimGridView, "GenericGridView" ); // Do not us
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridView::RimGridView()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &m_rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "" );
|
||||
m_rangeFilterCollection.uiCapability()->setUiHidden( true );
|
||||
m_rangeFilterCollection = new RimCellRangeFilterCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_overrideRangeFilterCollection,
|
||||
"RangeFiltersControlled",
|
||||
"Range Filters (controlled)",
|
||||
CAF_PDM_InitFieldNoDefault( &m_overrideCellFilterCollection,
|
||||
"CellFiltersControlled",
|
||||
"Cell Filters (controlled)",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
m_overrideRangeFilterCollection.uiCapability()->setUiHidden( true );
|
||||
m_overrideRangeFilterCollection.xmlCapability()->disableIO();
|
||||
m_overrideCellFilterCollection.uiCapability()->setUiHidden( true );
|
||||
m_overrideCellFilterCollection.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_intersectionCollection, "CrossSections", "Intersections", "", "", "" );
|
||||
m_intersectionCollection.uiCapability()->setUiHidden( true );
|
||||
@ -114,6 +110,10 @@ RimGridView::RimGridView()
|
||||
CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceInViewCollection", "Surface Collection Field", "", "", "" );
|
||||
m_surfaceCollection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellFilterCollection, "RangeFilters", "Cell Filter Collection Field", "", "", "" );
|
||||
m_cellFilterCollection = new RimCellFilterCollection();
|
||||
m_cellFilterCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
m_surfaceVizModel = new cvf::ModelBasicList;
|
||||
m_surfaceVizModel->setName( "SurfaceModel" );
|
||||
}
|
||||
@ -220,38 +220,38 @@ RimIntersectionResultsDefinitionCollection* RimGridView::separateSurfaceResultsC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridView::rangeFiltersUpdated()
|
||||
void RimGridView::cellFiltersUpdated()
|
||||
{
|
||||
updateViewFollowingRangeFilterUpdates();
|
||||
updateViewFollowingCellFilterUpdates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilterCollection* RimGridView::rangeFilterCollection()
|
||||
RimCellFilterCollection* RimGridView::cellFilterCollection()
|
||||
{
|
||||
if ( this->viewController() && this->viewController()->isRangeFiltersControlled() && m_overrideRangeFilterCollection )
|
||||
if ( this->viewController() && this->viewController()->isCellFiltersControlled() && m_overrideCellFilterCollection )
|
||||
{
|
||||
return m_overrideRangeFilterCollection;
|
||||
return m_overrideCellFilterCollection;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_rangeFilterCollection;
|
||||
return m_cellFilterCollection;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimCellRangeFilterCollection* RimGridView::rangeFilterCollection() const
|
||||
const RimCellFilterCollection* RimGridView::cellFilterCollection() const
|
||||
{
|
||||
if ( this->viewController() && this->viewController()->isRangeFiltersControlled() && m_overrideRangeFilterCollection )
|
||||
if ( this->viewController() && this->viewController()->isCellFiltersControlled() && m_overrideCellFilterCollection )
|
||||
{
|
||||
return m_overrideRangeFilterCollection;
|
||||
return m_overrideCellFilterCollection;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_rangeFilterCollection;
|
||||
return m_cellFilterCollection;
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,24 +266,24 @@ RimAnnotationInViewCollection* RimGridView::annotationCollection() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridView::hasOverridenRangeFilterCollection()
|
||||
bool RimGridView::hasOverriddenCellFilterCollection()
|
||||
{
|
||||
return m_overrideRangeFilterCollection() != nullptr;
|
||||
return m_overrideCellFilterCollection() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridView::setOverrideRangeFilterCollection( RimCellRangeFilterCollection* rfc )
|
||||
void RimGridView::setOverrideCellFilterCollection( RimCellFilterCollection* rfc )
|
||||
{
|
||||
if ( m_overrideRangeFilterCollection() ) delete m_overrideRangeFilterCollection();
|
||||
if ( m_overrideCellFilterCollection() ) delete m_overrideCellFilterCollection();
|
||||
|
||||
m_overrideRangeFilterCollection = rfc;
|
||||
m_overrideCellFilterCollection = rfc;
|
||||
// Maintain a link in the active-selection
|
||||
if ( m_overrideRangeFilterCollection )
|
||||
if ( m_overrideCellFilterCollection )
|
||||
{
|
||||
m_rangeFilterCollection->isActive = m_overrideRangeFilterCollection->isActive;
|
||||
m_rangeFilterCollection()->uiCapability()->updateConnectedEditors();
|
||||
m_cellFilterCollection->setActive( m_overrideCellFilterCollection->isActive() );
|
||||
m_cellFilterCollection()->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
this->scheduleGeometryRegen( RANGE_FILTERED );
|
||||
@ -294,12 +294,12 @@ void RimGridView::setOverrideRangeFilterCollection( RimCellRangeFilterCollection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridView::replaceRangeFilterCollectionWithOverride()
|
||||
void RimGridView::replaceCellFilterCollectionWithOverride()
|
||||
{
|
||||
RimCellRangeFilterCollection* overrideRfc = m_overrideRangeFilterCollection;
|
||||
RimCellFilterCollection* overrideRfc = m_overrideCellFilterCollection;
|
||||
CVF_ASSERT( overrideRfc );
|
||||
|
||||
RimCellRangeFilterCollection* currentRfc = m_rangeFilterCollection;
|
||||
RimCellFilterCollection* currentRfc = m_cellFilterCollection;
|
||||
if ( currentRfc )
|
||||
{
|
||||
delete currentRfc;
|
||||
@ -307,9 +307,9 @@ void RimGridView::replaceRangeFilterCollectionWithOverride()
|
||||
|
||||
// Must call removeChildObject() to make sure the object has no parent
|
||||
// No parent is required when assigning a object into a field
|
||||
m_overrideRangeFilterCollection.removeChildObject( overrideRfc );
|
||||
m_overrideCellFilterCollection.removeChildObject( overrideRfc );
|
||||
|
||||
m_rangeFilterCollection = overrideRfc;
|
||||
m_cellFilterCollection = overrideRfc;
|
||||
|
||||
this->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
@ -370,7 +370,7 @@ Rim3dOverlayInfoConfig* RimGridView::overlayInfoConfig() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridView::updateViewFollowingRangeFilterUpdates()
|
||||
void RimGridView::updateViewFollowingCellFilterUpdates()
|
||||
{
|
||||
showGridCells( true );
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class RimIntersectionCollection;
|
||||
class RimIntersectionResultsDefinitionCollection;
|
||||
class RimPropertyFilterCollection;
|
||||
class RimGridCollection;
|
||||
class RimCellRangeFilterCollection;
|
||||
class RimCellFilterCollection;
|
||||
class RimWellMeasurementInViewCollection;
|
||||
class RimSurfaceInViewCollection;
|
||||
|
||||
@ -55,13 +55,14 @@ public:
|
||||
RimWellMeasurementInViewCollection* measurementCollection() const;
|
||||
|
||||
virtual const RimPropertyFilterCollection* propertyFilterCollection() const = 0;
|
||||
void rangeFiltersUpdated();
|
||||
RimCellRangeFilterCollection* rangeFilterCollection();
|
||||
const RimCellRangeFilterCollection* rangeFilterCollection() const;
|
||||
|
||||
bool hasOverridenRangeFilterCollection();
|
||||
void setOverrideRangeFilterCollection( RimCellRangeFilterCollection* rfc );
|
||||
void replaceRangeFilterCollectionWithOverride();
|
||||
void cellFiltersUpdated();
|
||||
RimCellFilterCollection* cellFilterCollection();
|
||||
const RimCellFilterCollection* cellFilterCollection() const;
|
||||
|
||||
bool hasOverriddenCellFilterCollection();
|
||||
void setOverrideCellFilterCollection( RimCellFilterCollection* rfc );
|
||||
void replaceCellFilterCollectionWithOverride();
|
||||
|
||||
RimViewController* viewController() const override;
|
||||
RimViewLinker* assosiatedViewLinker() const override;
|
||||
@ -72,7 +73,7 @@ public:
|
||||
void updateSurfacesInViewTreeItems();
|
||||
|
||||
protected:
|
||||
virtual void updateViewFollowingRangeFilterUpdates();
|
||||
virtual void updateViewFollowingCellFilterUpdates();
|
||||
void onClearReservoirCellVisibilitiesIfNecessary() override;
|
||||
virtual void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep ) = 0;
|
||||
void selectOverlayInfoConfig() override;
|
||||
@ -92,12 +93,12 @@ protected:
|
||||
caf::PdmChildField<RimIntersectionResultsDefinitionCollection*> m_surfaceResultDefCollection;
|
||||
|
||||
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
|
||||
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
|
||||
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;
|
||||
caf::PdmChildField<RimGridCollection*> m_gridCollection;
|
||||
caf::PdmChildField<RimAnnotationInViewCollection*> m_annotationCollection;
|
||||
caf::PdmChildField<RimWellMeasurementInViewCollection*> m_wellMeasurementCollection;
|
||||
caf::PdmChildField<RimSurfaceInViewCollection*> m_surfaceCollection;
|
||||
caf::PdmChildField<RimCellFilterCollection*> m_cellFilterCollection;
|
||||
caf::PdmChildField<RimCellFilterCollection*> m_overrideCellFilterCollection;
|
||||
|
||||
private:
|
||||
void onCreatePartCollectionFromSelection( cvf::Collection<cvf::Part>* parts ) override;
|
||||
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RimPolylineTarget.h"
|
||||
#include "cafPickEventHandler.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimPolylinePickerInterface
|
||||
{
|
||||
public:
|
||||
virtual void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) = 0;
|
||||
virtual void updateEditorsAndVisualization() = 0;
|
||||
virtual void updateVisualization() = 0;
|
||||
virtual std::vector<RimPolylineTarget*> activeTargets() const = 0;
|
||||
virtual bool pickingEnabled() const = 0;
|
||||
virtual caf::PickEventHandler* pickEventHandler() const = 0;
|
||||
};
|
@ -30,7 +30,7 @@
|
||||
#include "RigSimulationWellCenterLineCalculator.h"
|
||||
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
@ -461,7 +461,7 @@ void RimSimWellInView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrder
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
if ( !reservoirView ) return;
|
||||
|
||||
if ( reservoirView->rangeFilterCollection() && !reservoirView->rangeFilterCollection()->hasActiveFilters() )
|
||||
if ( reservoirView->cellFilterCollection() && !reservoirView->cellFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
this->uiCapability()->setUiReadOnly( false );
|
||||
|
||||
@ -505,7 +505,7 @@ bool RimSimWellInView::isWellCellsVisible() const
|
||||
if ( reservoirView->intersectionCollection()->hasActiveIntersectionForSimulationWell( this ) ) return true;
|
||||
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells() &&
|
||||
reservoirView->rangeFilterCollection()->hasActiveFilters() )
|
||||
reservoirView->cellFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
return intersectsStaticWellCellsFilteredCells();
|
||||
}
|
||||
@ -546,7 +546,7 @@ bool RimSimWellInView::isWellPipeVisible( size_t frameIndex ) const
|
||||
if ( reservoirView->intersectionCollection()->hasActiveIntersectionForSimulationWell( this ) ) return true;
|
||||
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells() &&
|
||||
( reservoirView->rangeFilterCollection()->hasActiveFilters() ||
|
||||
( reservoirView->cellFilterCollection()->hasActiveFilters() ||
|
||||
reservoirView->propertyFilterCollection()->hasActiveFilters() ) )
|
||||
{
|
||||
return intersectsDynamicWellCellsFilteredCells( frameIndex );
|
||||
@ -588,7 +588,7 @@ bool RimSimWellInView::isWellSpheresVisible( size_t frameIndex ) const
|
||||
if ( reservoirView->intersectionCollection()->hasActiveIntersectionForSimulationWell( this ) ) return true;
|
||||
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells() &&
|
||||
reservoirView->rangeFilterCollection()->hasActiveFilters() )
|
||||
reservoirView->cellFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
return intersectsDynamicWellCellsFilteredCells( frameIndex );
|
||||
}
|
||||
|
@ -30,8 +30,9 @@
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
@ -42,6 +43,7 @@
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
@ -83,7 +85,7 @@ RimViewController::RimViewController()
|
||||
m_syncVisibleCells.uiCapability()->setUiHidden(true);
|
||||
m_syncVisibleCells.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField(&m_syncRangeFilters, "SyncRangeFilters", false, "Range Filters", "", "", "");
|
||||
CAF_PDM_InitField(&m_syncCellFilters, "SyncRangeFilters", false, "Cell Filters", "", "", "");
|
||||
CAF_PDM_InitField(&m_syncPropertyFilters, "SyncPropertyFilters", false,"Property Filters", "", "", "");
|
||||
// clang-format on
|
||||
|
||||
@ -163,7 +165,7 @@ void RimViewController::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
if ( !m_isActive )
|
||||
{
|
||||
applyRangeFilterCollectionByUserChoice();
|
||||
applyCellFilterCollectionByUserChoice();
|
||||
}
|
||||
|
||||
updateOverrides();
|
||||
@ -203,11 +205,11 @@ void RimViewController::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
updateLegendDefinitions();
|
||||
}
|
||||
else if ( changedField == &m_syncRangeFilters )
|
||||
else if ( changedField == &m_syncCellFilters )
|
||||
{
|
||||
if ( !m_syncRangeFilters )
|
||||
if ( !m_syncCellFilters )
|
||||
{
|
||||
applyRangeFilterCollectionByUserChoice();
|
||||
applyCellFilterCollectionByUserChoice();
|
||||
}
|
||||
updateOverrides();
|
||||
}
|
||||
@ -313,7 +315,7 @@ void RimViewController::updateOverrides()
|
||||
}
|
||||
}
|
||||
|
||||
this->updateRangeFilterOverrides( nullptr );
|
||||
this->updateCellFilterOverrides( nullptr );
|
||||
|
||||
if ( manGeoView )
|
||||
{
|
||||
@ -360,7 +362,7 @@ void RimViewController::removeOverrides( RimGridView* view )
|
||||
if ( manEclView ) manEclView->setOverridePropertyFilterCollection( nullptr );
|
||||
if ( manGeoView ) manGeoView->setOverridePropertyFilterCollection( nullptr );
|
||||
|
||||
view->setOverrideRangeFilterCollection( nullptr );
|
||||
view->setOverrideCellFilterCollection( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,7 +506,7 @@ void RimViewController::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
|
||||
|
||||
caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup( "Link Cell Filters" );
|
||||
visibleCells->add( &m_syncVisibleCells );
|
||||
visibleCells->add( &m_syncRangeFilters );
|
||||
visibleCells->add( &m_syncCellFilters );
|
||||
visibleCells->add( &m_syncPropertyFilters );
|
||||
}
|
||||
|
||||
@ -577,7 +579,7 @@ void RimViewController::updateLegendDefinitions()
|
||||
void RimViewController::updateDefaultOptions()
|
||||
{
|
||||
m_syncCellResult = isCellResultControlAdvisable();
|
||||
m_syncRangeFilters = isRangeFilterControlAdvisable();
|
||||
m_syncCellFilters = isCellFilterControlAdvisable();
|
||||
m_syncPropertyFilters = isPropertyFilterControlAdvisable();
|
||||
}
|
||||
|
||||
@ -714,7 +716,7 @@ void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView() co
|
||||
{
|
||||
if ( !this->isActive() ) return;
|
||||
|
||||
if ( this->isVisibleCellsOveridden() || this->isRangeFiltersControlled() || this->isPropertyFilterOveridden() ||
|
||||
if ( this->isVisibleCellsOveridden() || this->isCellFiltersControlled() || this->isPropertyFilterOveridden() ||
|
||||
this->isResultColorControlled() )
|
||||
{
|
||||
if ( this->managedView() )
|
||||
@ -736,7 +738,7 @@ void RimViewController::scheduleGeometryRegenForDepViews( RivCellSetEnum geometr
|
||||
{
|
||||
if ( !this->isActive() ) return;
|
||||
|
||||
if ( this->isVisibleCellsOveridden() || this->isRangeFiltersControlled() || this->isPropertyFilterOveridden() ||
|
||||
if ( this->isVisibleCellsOveridden() || this->isCellFiltersControlled() || this->isPropertyFilterOveridden() ||
|
||||
this->isResultColorControlled() )
|
||||
{
|
||||
if ( this->managedView() )
|
||||
@ -852,7 +854,7 @@ bool RimViewController::isVisibleCellsOveridden() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isRangeFilterMappingApplicable() const
|
||||
bool RimViewController::isCellFilterMappingApplicable() const
|
||||
{
|
||||
if ( !isMasterAndDepViewDifferentType() ) return false;
|
||||
|
||||
@ -895,7 +897,7 @@ bool RimViewController::isCellResultControlAdvisable() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isRangeFilterControlAdvisable() const
|
||||
bool RimViewController::isCellFilterControlAdvisable() const
|
||||
{
|
||||
bool contourMapMasterView = dynamic_cast<RimEclipseContourMapView*>( masterView() ) != nullptr;
|
||||
bool contourMapManagedView = dynamic_cast<RimEclipseContourMapView*>( managedEclipseView() ) != nullptr;
|
||||
@ -915,11 +917,11 @@ bool RimViewController::isPropertyFilterControlAdvisable() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isRangeFiltersControlled() const
|
||||
bool RimViewController::isCellFiltersControlled() const
|
||||
{
|
||||
if ( ownerViewLinker() && ownerViewLinker()->isActive() && this->m_isActive() )
|
||||
{
|
||||
return m_syncRangeFilters;
|
||||
return m_syncCellFilters;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -977,76 +979,118 @@ bool RimViewController::isPropertyFilterOveridden() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewController::updateRangeFilterOverrides( RimCellRangeFilter* changedRangeFilter )
|
||||
void RimViewController::updateCellFilterOverrides( const RimCellFilter* changedFilter )
|
||||
{
|
||||
if ( !m_managedView ) return;
|
||||
|
||||
if ( !isRangeFiltersControlled() )
|
||||
if ( !isCellFiltersControlled() )
|
||||
{
|
||||
m_managedView->setOverrideRangeFilterCollection( nullptr );
|
||||
|
||||
m_managedView->setOverrideCellFilterCollection( nullptr );
|
||||
return;
|
||||
}
|
||||
// Copy the rangeFilterCollection
|
||||
|
||||
// Todo: Optimize by only mapping the changed range filter, if needed.
|
||||
RimCellFilterCollection* sourceFilterCollection = masterView()->cellFilterCollection();
|
||||
QString xmlFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
|
||||
PdmObjectHandle* objectCopy =
|
||||
PdmXmlObjectHandle::readUnknownObjectFromXmlString( xmlFilterCollCopy,
|
||||
caf::PdmDefaultObjectFactory::instance(),
|
||||
true );
|
||||
RimCellFilterCollection* overrideFilterColl = dynamic_cast<RimCellFilterCollection*>( objectCopy );
|
||||
|
||||
std::vector<RimCellFilter*> srcFilters = sourceFilterCollection->filters();
|
||||
std::vector<RimCellFilter*> dstFilters = overrideFilterColl->filters();
|
||||
RimEclipseView* depEclView = managedEclipseView();
|
||||
RimGeoMechView* depGeomView = managedGeoView();
|
||||
|
||||
// Convert the cell filter to fit in the managed view if needed
|
||||
if ( isCellFilterMappingApplicable() )
|
||||
{
|
||||
// Copy the rangeFilterCollection
|
||||
RimEclipseView* eclipseMasterView = dynamic_cast<RimEclipseView*>( masterView() );
|
||||
RimGeoMechView* geoMasterView = dynamic_cast<RimGeoMechView*>( masterView() );
|
||||
|
||||
RimCellRangeFilterCollection* sourceFilterCollection = masterView()->rangeFilterCollection();
|
||||
QString xmlRangeFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
|
||||
PdmObjectHandle* objectCopy =
|
||||
PdmXmlObjectHandle::readUnknownObjectFromXmlString( xmlRangeFilterCollCopy,
|
||||
caf::PdmDefaultObjectFactory::instance(),
|
||||
true );
|
||||
RimCellRangeFilterCollection* overrideRangeFilterColl = dynamic_cast<RimCellRangeFilterCollection*>( objectCopy );
|
||||
|
||||
// Convert the range filter to fit in the managed view if needed
|
||||
if ( isRangeFilterMappingApplicable() )
|
||||
if ( eclipseMasterView && depGeomView )
|
||||
{
|
||||
RimEclipseView* eclipseMasterView = dynamic_cast<RimEclipseView*>( masterView() );
|
||||
RimGeoMechView* geoMasterView = dynamic_cast<RimGeoMechView*>( masterView() );
|
||||
RimEclipseView* depEclView = managedEclipseView();
|
||||
RimGeoMechView* depGeomView = managedGeoView();
|
||||
|
||||
if ( eclipseMasterView && depGeomView )
|
||||
if ( eclipseMasterView->mainGrid() )
|
||||
{
|
||||
if ( eclipseMasterView->mainGrid() )
|
||||
RigMainGrid* srcEclGrid = eclipseMasterView->mainGrid();
|
||||
RigFemPart* dstFemPart = depGeomView->femParts()->part( 0 );
|
||||
|
||||
for ( size_t rfIdx = 0; rfIdx < srcFilters.size(); ++rfIdx )
|
||||
{
|
||||
RigMainGrid* srcEclGrid = eclipseMasterView->mainGrid();
|
||||
RigFemPart* dstFemPart = depGeomView->femParts()->part( 0 );
|
||||
for ( size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx )
|
||||
overrideFilterColl->connectToFilterUpdates( dstFilters[rfIdx] );
|
||||
|
||||
RimCellRangeFilter* srcRFilter = dynamic_cast<RimCellRangeFilter*>( srcFilters[rfIdx] );
|
||||
RimCellRangeFilter* dstRFilter = dynamic_cast<RimCellRangeFilter*>( dstFilters[rfIdx] );
|
||||
|
||||
if ( ( srcRFilter != nullptr ) && ( dstRFilter != nullptr ) )
|
||||
{
|
||||
RimCellRangeFilter* srcRFilter = sourceFilterCollection->rangeFilters[rfIdx];
|
||||
RimCellRangeFilter* dstRFilter = overrideRangeFilterColl->rangeFilters[rfIdx];
|
||||
RigCaseToCaseRangeFilterMapper::convertRangeFilterEclToFem( srcRFilter,
|
||||
srcEclGrid,
|
||||
dstRFilter,
|
||||
dstFemPart );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( geoMasterView && depEclView )
|
||||
{
|
||||
if ( depEclView->mainGrid() )
|
||||
{
|
||||
RigFemPart* srcFemPart = geoMasterView->femParts()->part( 0 );
|
||||
RigMainGrid* dstEclGrid = depEclView->mainGrid();
|
||||
for ( size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx )
|
||||
|
||||
RimPolylineFilter* polyDstFilter = dynamic_cast<RimPolylineFilter*>( dstFilters[rfIdx] );
|
||||
if ( polyDstFilter != nullptr )
|
||||
{
|
||||
RimCellRangeFilter* srcRFilter = sourceFilterCollection->rangeFilters[rfIdx];
|
||||
RimCellRangeFilter* dstRFilter = overrideRangeFilterColl->rangeFilters[rfIdx];
|
||||
RigCaseToCaseRangeFilterMapper::convertRangeFilterFemToEcl( srcRFilter,
|
||||
srcFemPart,
|
||||
dstRFilter,
|
||||
dstEclGrid );
|
||||
RimGeoMechCase* gCase = depGeomView->geoMechCase();
|
||||
polyDstFilter->setCase( gCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( geoMasterView && depEclView )
|
||||
{
|
||||
if ( depEclView->mainGrid() )
|
||||
{
|
||||
RigFemPart* srcFemPart = geoMasterView->femParts()->part( 0 );
|
||||
RigMainGrid* dstEclGrid = depEclView->mainGrid();
|
||||
for ( size_t rfIdx = 0; rfIdx < srcFilters.size(); ++rfIdx )
|
||||
{
|
||||
overrideFilterColl->connectToFilterUpdates( dstFilters[rfIdx] );
|
||||
|
||||
m_managedView->setOverrideRangeFilterCollection( overrideRangeFilterColl );
|
||||
RimCellRangeFilter* srcRFilter = dynamic_cast<RimCellRangeFilter*>( srcFilters[rfIdx] );
|
||||
RimCellRangeFilter* dstRFilter = dynamic_cast<RimCellRangeFilter*>( dstFilters[rfIdx] );
|
||||
|
||||
if ( ( srcRFilter != nullptr ) && ( dstRFilter != nullptr ) )
|
||||
{
|
||||
RigCaseToCaseRangeFilterMapper::convertRangeFilterFemToEcl( srcRFilter,
|
||||
srcFemPart,
|
||||
dstRFilter,
|
||||
dstEclGrid );
|
||||
continue;
|
||||
}
|
||||
|
||||
RimPolylineFilter* polyDstFilter = dynamic_cast<RimPolylineFilter*>( dstFilters[rfIdx] );
|
||||
if ( polyDstFilter != nullptr )
|
||||
{
|
||||
RimEclipseCase* eCase = depEclView->eclipseCase();
|
||||
polyDstFilter->setCase( eCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( size_t rfIdx = 0; rfIdx < dstFilters.size(); ++rfIdx )
|
||||
{
|
||||
overrideFilterColl->connectToFilterUpdates( dstFilters[rfIdx] );
|
||||
|
||||
RimPolylineFilter* polyDstFilter = dynamic_cast<RimPolylineFilter*>( dstFilters[rfIdx] );
|
||||
if ( polyDstFilter != nullptr )
|
||||
{
|
||||
RimCase* theCase = nullptr;
|
||||
if ( depEclView ) theCase = depEclView->eclipseCase();
|
||||
if ( depGeomView ) theCase = depGeomView->geoMechCase();
|
||||
polyDstFilter->setCase( theCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_managedView->setOverrideCellFilterCollection( overrideFilterColl );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1060,30 +1104,30 @@ void RimViewController::updatePropertyFilterOverrides( RimPropertyFilter* change
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewController::applyRangeFilterCollectionByUserChoice()
|
||||
void RimViewController::applyCellFilterCollectionByUserChoice()
|
||||
{
|
||||
if ( !m_managedView ) return;
|
||||
|
||||
if ( !m_managedView->hasOverridenRangeFilterCollection() )
|
||||
if ( !m_managedView->hasOverriddenCellFilterCollection() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool restoreOriginal = askUserToRestoreOriginalRangeFilterCollection( m_managedView->name() );
|
||||
bool restoreOriginal = askUserToRestoreOriginalCellFilterCollection( m_managedView->name() );
|
||||
if ( restoreOriginal )
|
||||
{
|
||||
m_managedView->setOverrideRangeFilterCollection( nullptr );
|
||||
m_managedView->setOverrideCellFilterCollection( nullptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_managedView->replaceRangeFilterCollectionWithOverride();
|
||||
m_managedView->replaceCellFilterCollectionWithOverride();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::askUserToRestoreOriginalRangeFilterCollection( const QString& viewName )
|
||||
bool RimViewController::askUserToRestoreOriginalCellFilterCollection( const QString& viewName )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
|
||||
@ -1091,10 +1135,10 @@ bool RimViewController::askUserToRestoreOriginalRangeFilterCollection( const QSt
|
||||
msgBox.setIcon( QMessageBox::Question );
|
||||
|
||||
QString questionText;
|
||||
questionText = QString( "The range filters in the view \"%1\" are about to be unlinked." ).arg( viewName );
|
||||
questionText = QString( "The cell filters in the view \"%1\" are about to be unlinked." ).arg( viewName );
|
||||
|
||||
msgBox.setText( questionText );
|
||||
msgBox.setInformativeText( "Do you want to keep the range filters from the primary view?" );
|
||||
msgBox.setInformativeText( "Do you want to keep the cell filters from the primary view?" );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||
|
||||
int ret = msgBox.exec();
|
||||
|
@ -33,7 +33,7 @@ class RimEclipseView;
|
||||
class RimGeoMechView;
|
||||
class RimViewLinker;
|
||||
class RigCaseToCaseCellMapper;
|
||||
class RimCellRangeFilter;
|
||||
class RimCellFilter;
|
||||
class RimPropertyFilter;
|
||||
|
||||
//==================================================================================================
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
bool isResultColorControlled() const;
|
||||
bool isLegendDefinitionsControlled() const;
|
||||
bool isRangeFiltersControlled() const;
|
||||
bool isCellFiltersControlled() const;
|
||||
|
||||
bool isVisibleCellsOveridden() const;
|
||||
bool isPropertyFilterOveridden() const;
|
||||
@ -76,8 +76,8 @@ public:
|
||||
void removeOverrides();
|
||||
void updateDisplayNameAndIcon();
|
||||
|
||||
void updateRangeFilterOverrides( RimCellRangeFilter* changedRangeFilter );
|
||||
void applyRangeFilterCollectionByUserChoice();
|
||||
void updateCellFilterOverrides( const RimCellFilter* changedFilter );
|
||||
void applyCellFilterCollectionByUserChoice();
|
||||
void updatePropertyFilterOverrides( RimPropertyFilter* changedPropertyFilter );
|
||||
|
||||
protected: // Pdm overridden methods
|
||||
@ -101,16 +101,16 @@ private:
|
||||
bool isCameraControlPossible() const;
|
||||
bool isMasterAndDepViewDifferentType() const;
|
||||
bool isPropertyFilterControlPossible() const;
|
||||
bool isRangeFilterMappingApplicable() const;
|
||||
bool isCellFilterMappingApplicable() const;
|
||||
bool isCellResultControlAdvisable() const;
|
||||
bool isRangeFilterControlAdvisable() const;
|
||||
bool isCellFilterControlAdvisable() const;
|
||||
bool isPropertyFilterControlAdvisable() const;
|
||||
|
||||
RimEclipseView* managedEclipseView() const;
|
||||
RimGeoMechView* managedGeoView() const;
|
||||
|
||||
static void removeOverrides( RimGridView* view );
|
||||
static bool askUserToRestoreOriginalRangeFilterCollection( const QString& viewName );
|
||||
static bool askUserToRestoreOriginalCellFilterCollection( const QString& viewName );
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
@ -125,7 +125,7 @@ private:
|
||||
caf::PdmField<bool> m_syncCellResult;
|
||||
caf::PdmField<bool> m_syncLegendDefinitions;
|
||||
|
||||
caf::PdmField<bool> m_syncRangeFilters;
|
||||
caf::PdmField<bool> m_syncCellFilters;
|
||||
caf::PdmField<bool> m_syncVisibleCells;
|
||||
caf::PdmField<bool> m_syncPropertyFilters;
|
||||
|
||||
|
@ -207,11 +207,11 @@ void RimViewLinker::updateCellResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::updateRangeFilters( RimCellRangeFilter* changedRangeFilter )
|
||||
void RimViewLinker::updateCellFilters( const RimCellFilter* changedFilter )
|
||||
{
|
||||
for ( RimViewController* viewLink : m_viewControllers )
|
||||
{
|
||||
viewLink->updateRangeFilterOverrides( changedRangeFilter );
|
||||
viewLink->updateCellFilterOverrides( changedFilter );
|
||||
}
|
||||
}
|
||||
|
||||
@ -649,11 +649,11 @@ void RimViewLinker::addViewControllers( caf::PdmUiTreeOrdering& uiTreeOrdering )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::applyRangeFilterCollectionByUserChoice()
|
||||
void RimViewLinker::applyCellFilterCollectionByUserChoice()
|
||||
{
|
||||
for ( const auto& viewController : m_viewControllers )
|
||||
{
|
||||
viewController->applyRangeFilterCollectionByUserChoice();
|
||||
viewController->applyCellFilterCollectionByUserChoice();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class BoundingBox;
|
||||
class RimViewController;
|
||||
class RiuViewer;
|
||||
class RimGridView;
|
||||
class RimCellRangeFilter;
|
||||
class RimCellFilter;
|
||||
class RimPropertyFilter;
|
||||
|
||||
//==================================================================================================
|
||||
@ -74,8 +74,8 @@ public:
|
||||
|
||||
void updateCellResult();
|
||||
|
||||
void updateRangeFilters( RimCellRangeFilter* changedRangeFilter );
|
||||
void applyRangeFilterCollectionByUserChoice();
|
||||
void updateCellFilters( const RimCellFilter* changedFilter );
|
||||
void applyCellFilterCollectionByUserChoice();
|
||||
|
||||
void updatePropertyFilters( RimPropertyFilter* changedPropertyFilter );
|
||||
|
||||
|
@ -76,7 +76,7 @@ void RimViewLinkerCollection::fieldChangedByUi( const caf::PdmFieldHandle* chang
|
||||
{
|
||||
if ( !isActive )
|
||||
{
|
||||
viewLinker()->applyRangeFilterCollectionByUserChoice();
|
||||
viewLinker()->applyCellFilterCollectionByUserChoice();
|
||||
}
|
||||
|
||||
viewLinker()->updateDependentViews();
|
||||
|
@ -399,3 +399,22 @@ void RigCell::faceIndices( cvf::StructGridInterface::FaceType face, std::array<s
|
||||
( *indices )[2] = m_cornerIndices[faceVertexIndices[2]];
|
||||
( *indices )[3] = m_cornerIndices[faceVertexIndices[3]];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RigCell::boundingBox() const
|
||||
{
|
||||
cvf::BoundingBox bb;
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
|
||||
if ( m_hostGrid && m_hostGrid->mainGrid() )
|
||||
{
|
||||
m_hostGrid->mainGrid()->cellCornerVertices( mainGridCellIndex(), hexCorners.data() );
|
||||
for ( const auto& corner : hexCorners )
|
||||
{
|
||||
bb.add( corner );
|
||||
}
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ public:
|
||||
bool isLongPyramidCell( double maxHeightFactor = 5, double nodeNearTolerance = 1e-3 ) const;
|
||||
bool isCollapsedCell( double nodeNearTolerance = 1e-3 ) const;
|
||||
|
||||
cvf::BoundingBox boundingBox() const;
|
||||
|
||||
private:
|
||||
std::array<size_t, 8> m_cornerIndices;
|
||||
|
||||
|
@ -787,3 +787,58 @@ std::vector<cvf::Vec3d>
|
||||
|
||||
return adjustedPolygon;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// tests if a point is Left|On|Right of an infinite line.
|
||||
/// Input: three points P1, P2, and P3
|
||||
/// Return: >0 for P3 left of the line through P1 and P2
|
||||
/// =0 for P3 on the line
|
||||
/// <0 for P3 right of the line
|
||||
/// ref. http://geomalgorithms.com/a01-_area.html
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
inline double
|
||||
RigCellGeometryTools::isLeftOfLine2D( const cvf::Vec3d& point1, const cvf::Vec3d& point2, const cvf::Vec3d& point3 )
|
||||
{
|
||||
return ( ( point2.x() - point1.x() ) * ( point3.y() - point1.y() ) -
|
||||
( point3.x() - point1.x() ) * ( point2.y() - point1.y() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// winding number test for a point in a polygon
|
||||
/// Input: point = the point to test,
|
||||
/// polygon[] = vertex points of a closed polygon of size n, where polygon[n-1]=polygon[0]
|
||||
///
|
||||
/// Return: true if inside, false if outside)
|
||||
/// ref. http://geomalgorithms.com/a03-_inclusion.html
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigCellGeometryTools::pointInsidePolygon2D( const cvf::Vec3d point, const std::vector<cvf::Vec3d>& polygon )
|
||||
{
|
||||
// Copyright 2000 softSurfer, 2012 Dan Sunday
|
||||
// This code may be freely used and modified for any purpose
|
||||
// providing that this copyright notice is included with it.
|
||||
// SoftSurfer makes no warranty for this code, and cannot be held
|
||||
// liable for any real or imagined damage resulting from its use.
|
||||
// Users of this code must verify correctness for their application
|
||||
|
||||
int wn = 0; // the winding number counter
|
||||
|
||||
size_t N = polygon.size() - 1;
|
||||
|
||||
// loop through all edges of the polygon
|
||||
for ( size_t i = 0; i < N; i++ )
|
||||
{ // edge from V[i] to V[i+1]
|
||||
if ( polygon[i].y() <= point.y() )
|
||||
{ // start y <= P.y
|
||||
if ( polygon[i + 1].y() > point.y() ) // an upward crossing
|
||||
if ( isLeftOfLine2D( polygon[i], polygon[i + 1], point ) > 0 ) // P left of edge
|
||||
++wn; // have a valid up intersect
|
||||
}
|
||||
else
|
||||
{ // start y > P.y
|
||||
if ( polygon[i + 1].y() <= point.y() ) // a downward crossing
|
||||
if ( isLeftOfLine2D( polygon[i], polygon[i + 1], point ) < 0 ) // P right of edge
|
||||
--wn; // have a valid down intersect
|
||||
}
|
||||
}
|
||||
return wn != 0;
|
||||
}
|
||||
|
@ -80,7 +80,11 @@ public:
|
||||
|
||||
static std::vector<cvf::Vec3d> unionOfPolygons( const std::vector<std::vector<cvf::Vec3d>>& polygons );
|
||||
|
||||
static bool pointInsidePolygon2D( const cvf::Vec3d point, const std::vector<cvf::Vec3d>& polygon );
|
||||
|
||||
private:
|
||||
static std::vector<cvf::Vec3d> ajustPolygonToAvoidIntersectionsAtVertex( const std::vector<cvf::Vec3d>& polyLine,
|
||||
const std::vector<cvf::Vec3d>& polygon );
|
||||
|
||||
static double isLeftOfLine2D( const cvf::Vec3d& point1, const cvf::Vec3d& point2, const cvf::Vec3d& point3 );
|
||||
};
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
|
||||
const std::vector<std::vector<cvf::Vec3d>>& polyLines() const { return m_polylines; }
|
||||
void setPolyLines( const std::vector<std::vector<cvf::Vec3d>>& polyLines ) { m_polylines = polyLines; }
|
||||
void setPolyLine( const std::vector<cvf::Vec3d>& polyline ) { m_polylines = { polyline }; }
|
||||
|
||||
private:
|
||||
std::vector<std::vector<cvf::Vec3d>> m_polylines;
|
||||
|
@ -35,7 +35,6 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user