mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Polygon filter updates (#7216)
* Rename polylinefilter to polygonfilter * Update icon name, too * Some GUI adjustments * Remove obsolete code that came back in a merge somewhere. Disable auto-enable polygon filter after picking corner points. * Add option to delete a point in polygon filter point editor by extending generic picker interface * Rename enum, too. * Improved filter naming Co-authored-by: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
This commit is contained in:
Before Width: | Height: | Size: 645 B After Width: | Height: | Size: 645 B |
@@ -223,13 +223,13 @@
|
||||
<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>
|
||||
<file>CellFilter_Polygon.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewUserDefinedFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCellRangeFilterFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceFeature.h
|
||||
@@ -8,11 +8,11 @@ ${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
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonFilter3dviewFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewUserDefinedFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCellRangeFilterFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRangeFilterSliceFeature.cpp
|
||||
@@ -20,7 +20,7 @@ ${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
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonFilter3dviewFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES
|
||||
|
@@ -16,13 +16,13 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewPolylineFilter3dviewFeature.h"
|
||||
#include "RicNewPolygonFilter3dviewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimPolygonFilter.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewPolylineFilter3dviewFeature, "RicNewPolylineFilter3dviewFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicNewPolygonFilter3dviewFeature, "RicNewPolygonFilter3dviewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineFilter3dviewFeature::isCommandEnabled()
|
||||
bool RicNewPolygonFilter3dviewFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ bool RicNewPolylineFilter3dviewFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineFilter3dviewFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewPolygonFilter3dviewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
// Get the selected Cell Filter Collection
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
@@ -53,7 +53,7 @@ void RicNewPolylineFilter3dviewFeature::onActionTriggered( bool isChecked )
|
||||
// and the case to use
|
||||
RimCase* sourceCase = viewOrComparisonView->ownerCase();
|
||||
|
||||
RimPolylineFilter* lastCreatedOrUpdated = filtColl->addNewPolylineFilter( sourceCase );
|
||||
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
@@ -63,8 +63,8 @@ void RicNewPolylineFilter3dviewFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineFilter3dviewFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewPolygonFilter3dviewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Polyline.png" ) );
|
||||
actionToSetup->setText( "Polyline Filter" );
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Polygon.png" ) );
|
||||
actionToSetup->setText( "Polygon Filter" );
|
||||
}
|
@@ -23,12 +23,11 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPolylineFilter3dviewFeature : public caf::CmdFeature
|
||||
class RicNewPolygonFilter3dviewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
@@ -16,11 +16,11 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewPolylineFilterFeature.h"
|
||||
#include "RicNewPolygonFilterFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimPolygonFilter.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewPolylineFilterFeature, "RicNewPolylineFilterFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicNewPolygonFilterFeature, "RicNewPolygonFilterFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineFilterFeature::isCommandEnabled()
|
||||
bool RicNewPolygonFilterFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ bool RicNewPolylineFilterFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineFilterFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
// Find the selected Cell Filter Collection
|
||||
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
|
||||
@@ -52,7 +52,7 @@ void RicNewPolylineFilterFeature::onActionTriggered( bool isChecked )
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
|
||||
RimPolylineFilter* lastCreatedOrUpdated = filtColl->addNewPolylineFilter( sourceCase );
|
||||
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
@@ -62,8 +62,8 @@ void RicNewPolylineFilterFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicNewPolygonFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Polyline.png" ) );
|
||||
actionToSetup->setText( "New Polyline Filter" );
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Polygon.png" ) );
|
||||
actionToSetup->setText( "New Polygon Filter" );
|
||||
}
|
@@ -23,7 +23,7 @@
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPolylineFilterFeature : public caf::CmdFeature
|
||||
class RicNewPolygonFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor 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
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor 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
|
||||
@@ -29,7 +29,6 @@ protected:
|
||||
RicNewRangeFilterSliceFeature( QString cmdText, int sliceDirection );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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
|
||||
@@ -15,15 +15,18 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicDeletePolylineTargetFeature.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeletePolylineTargetFeature, "RicDeletePolylineTargetFeature" );
|
||||
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeletePolylineTargetFeature, "RicDeletePolylineTargetFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -50,7 +53,7 @@ void RicDeletePolylineTargetFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( !targets.empty() )
|
||||
{
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef = nullptr;
|
||||
RimPolylinePickerInterface* polylineDef = nullptr;
|
||||
targets[0]->firstAncestorOrThisOfTypeAsserted( polylineDef );
|
||||
|
||||
for ( auto target : targets )
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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
|
||||
@@ -28,7 +28,6 @@ class RicDeletePolylineTargetFeature : 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) 2018 - Equinor
|
||||
// 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
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPolylineTarget, "PolylineTarget" );
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 - Equinor
|
||||
// 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,14 +17,19 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaLineArcWellPathCalculator.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimPolylineTarget : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
@@ -142,10 +142,10 @@ void RimUserDefinedPolylinesAnnotation::insertTarget( const RimPolylineTarget* t
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::deleteTarget( RimPolylineTarget* targetTodelete )
|
||||
void RimUserDefinedPolylinesAnnotation::deleteTarget( RimPolylineTarget* targetToDelete )
|
||||
{
|
||||
m_targets.removeChildObject( targetTodelete );
|
||||
delete targetTodelete;
|
||||
m_targets.removeChildObject( targetToDelete );
|
||||
delete targetToDelete;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -50,6 +50,7 @@ public:
|
||||
bool isEmpty() override;
|
||||
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
|
||||
void deleteTarget( RimPolylineTarget* targetToDelete ) override;
|
||||
void updateEditorsAndVisualization() override;
|
||||
void updateVisualization() override;
|
||||
|
||||
@@ -58,7 +59,6 @@ public:
|
||||
caf::PickEventHandler* pickEventHandler() const override;
|
||||
|
||||
void appendTarget( const cvf::Vec3d& defaultPos = cvf::Vec3d::ZERO );
|
||||
void deleteTarget( RimPolylineTarget* targetTodelete );
|
||||
|
||||
std::pair<RimPolylineTarget*, RimPolylineTarget*>
|
||||
findActiveTargetsAroundInsertionPoint( const RimPolylineTarget* targetToInsertBefore );
|
||||
|
@@ -9,7 +9,7 @@ ${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}/RimPolygonFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedFilter.h
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ ${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}/RimPolygonFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedFilter.cpp
|
||||
)
|
||||
|
||||
|
@@ -55,6 +55,12 @@ RimCellFilter::RimCellFilter()
|
||||
|
||||
CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid", "", "", "" );
|
||||
CAF_PDM_InitField( &m_propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" );
|
||||
m_nameProxy.registerGetMethod( this, &RimCellFilter::fullName );
|
||||
m_nameProxy.uiCapability()->setUiReadOnly( true );
|
||||
m_nameProxy.uiCapability()->setUiHidden( true );
|
||||
m_nameProxy.xmlCapability()->disableIO();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -69,7 +75,15 @@ RimCellFilter::~RimCellFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
return &m_nameProxy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Return the name to show in the tree selector
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellFilter::fullName() const
|
||||
{
|
||||
return QString( "%1" ).arg( m_name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafSignal.h"
|
||||
|
||||
namespace cvf
|
||||
@@ -49,13 +50,16 @@ public:
|
||||
RimCellFilter();
|
||||
~RimCellFilter() override;
|
||||
|
||||
QString name() const;
|
||||
bool isActive() const;
|
||||
QString name() const;
|
||||
void setName( QString filtername );
|
||||
|
||||
bool isActive() const;
|
||||
void setActive( bool active );
|
||||
|
||||
caf::AppEnum<FilterModeType> filterMode() const;
|
||||
void setName( QString filtername );
|
||||
void setActive( bool active );
|
||||
QString modeString() const;
|
||||
bool propagateToSubGrids() const;
|
||||
|
||||
bool propagateToSubGrids() const;
|
||||
|
||||
void setGridIndex( int gridIndex );
|
||||
int gridIndex() const;
|
||||
@@ -63,7 +67,8 @@ public:
|
||||
void updateIconState();
|
||||
void updateActiveState( bool isControlled );
|
||||
|
||||
virtual void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) = 0;
|
||||
virtual void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) = 0;
|
||||
virtual QString fullName() const;
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
@@ -77,8 +82,9 @@ protected:
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmProxyValueField<QString> m_nameProxy;
|
||||
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
|
||||
caf::PdmField<bool> m_propagateToSubGrids;
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimPolygonFilter.h"
|
||||
#include "RimUserDefinedFilter.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
@@ -229,17 +229,13 @@ bool RimCellFilterCollection::hasActiveIncludeFilters() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineFilter* RimCellFilterCollection::addNewPolylineFilter( RimCase* srcCase )
|
||||
RimPolygonFilter* RimCellFilterCollection::addNewPolygonFilter( RimCase* srcCase )
|
||||
{
|
||||
RimPolylineFilter* pFilter = new RimPolylineFilter();
|
||||
RimPolygonFilter* pFilter = new RimPolygonFilter();
|
||||
pFilter->setCase( srcCase );
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
pFilter->setActive( false );
|
||||
|
||||
this->updateConnectedEditors();
|
||||
addFilter( pFilter );
|
||||
onFilterUpdated( pFilter );
|
||||
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
@@ -249,12 +245,8 @@ RimPolylineFilter* RimCellFilterCollection::addNewPolylineFilter( RimCase* srcCa
|
||||
RimUserDefinedFilter* RimCellFilterCollection::addNewUserDefinedFilter( RimCase* srcCase )
|
||||
{
|
||||
RimUserDefinedFilter* pFilter = new RimUserDefinedFilter();
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
|
||||
this->updateConnectedEditors();
|
||||
addFilter( pFilter );
|
||||
onFilterUpdated( pFilter );
|
||||
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
@@ -264,14 +256,50 @@ RimUserDefinedFilter* RimCellFilterCollection::addNewUserDefinedFilter( RimCase*
|
||||
RimCellRangeFilter* RimCellFilterCollection::addNewCellRangeFilter( RimCase* srcCase, int sliceDirection, int defaultSlice )
|
||||
{
|
||||
RimCellRangeFilter* pFilter = new RimCellRangeFilter();
|
||||
addFilter( pFilter );
|
||||
pFilter->setDefaultValues( sliceDirection, defaultSlice );
|
||||
onFilterUpdated( pFilter );
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::addFilter( RimCellFilter* pFilter )
|
||||
{
|
||||
setAutoName( pFilter );
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
pFilter->setDefaultValues( sliceDirection, defaultSlice );
|
||||
|
||||
this->updateConnectedEditors();
|
||||
onFilterUpdated( pFilter );
|
||||
}
|
||||
|
||||
return pFilter;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::setAutoName( RimCellFilter* pFilter )
|
||||
{
|
||||
int nPolyFilters = 1;
|
||||
int nRangeFilters = 1;
|
||||
int nUserFilters = 1;
|
||||
|
||||
for ( RimCellFilter* filter : m_cellFilters )
|
||||
{
|
||||
if ( dynamic_cast<RimCellRangeFilter*>( filter ) ) nRangeFilters++;
|
||||
if ( dynamic_cast<RimUserDefinedFilter*>( filter ) ) nUserFilters++;
|
||||
if ( dynamic_cast<RimPolygonFilter*>( filter ) ) nPolyFilters++;
|
||||
}
|
||||
if ( dynamic_cast<RimCellRangeFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "Range Filter %1" ).arg( QString::number( nRangeFilters ) ) );
|
||||
}
|
||||
else if ( dynamic_cast<RimUserDefinedFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "User Defined Filter %1" ).arg( QString::number( nUserFilters ) ) );
|
||||
}
|
||||
else if ( dynamic_cast<RimPolygonFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "Polygon Filter %1" ).arg( QString::number( nPolyFilters ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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,10 +24,9 @@
|
||||
|
||||
class RimCellFilter;
|
||||
class RimCellRangeFilter;
|
||||
class RimPolylineFilter;
|
||||
class RimPolygonFilter;
|
||||
class RimUserDefinedFilter;
|
||||
class RimCase;
|
||||
class RigPolyLinesData;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -46,7 +45,7 @@ public:
|
||||
RimCellFilterCollection();
|
||||
~RimCellFilterCollection() override;
|
||||
|
||||
RimPolylineFilter* addNewPolylineFilter( RimCase* srcCase );
|
||||
RimPolygonFilter* addNewPolygonFilter( RimCase* srcCase );
|
||||
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
||||
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int sliceDirection = -1, int defaultSlice = -1 );
|
||||
|
||||
@@ -78,6 +77,9 @@ protected:
|
||||
void onFilterUpdated( const SignalEmitter* emitter );
|
||||
|
||||
private:
|
||||
void setAutoName( RimCellFilter* pFilter );
|
||||
void addFilter( RimCellFilter* pFilter );
|
||||
|
||||
caf::PdmChildArrayField<RimCellFilter*> m_cellFilters;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
|
@@ -69,6 +69,39 @@ RimCellRangeFilter::~RimCellRangeFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellRangeFilter::fullName() const
|
||||
{
|
||||
QString postfix;
|
||||
if ( ( cellCountI == 1 ) && ( cellCountJ > 1 ) && ( cellCountK > 1 ) )
|
||||
{
|
||||
postfix = QString( "I-slice %1" ).arg( QString::number( startIndexI ) );
|
||||
}
|
||||
else if ( ( cellCountJ == 1 ) && ( cellCountI > 1 ) && ( cellCountK > 1 ) )
|
||||
{
|
||||
postfix = QString( "J-slice %1" ).arg( QString::number( startIndexJ ) );
|
||||
}
|
||||
else if ( ( cellCountK == 1 ) && ( cellCountI > 1 ) && ( cellCountJ > 1 ) )
|
||||
{
|
||||
postfix = QString( "K-slice %1" ).arg( QString::number( startIndexK ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QString irange =
|
||||
QString( "I=%1-%2" ).arg( QString::number( startIndexI ), QString::number( startIndexI + cellCountI - 1 ) );
|
||||
QString jrange =
|
||||
QString( "J=%1-%2" ).arg( QString::number( startIndexJ ), QString::number( startIndexJ + cellCountJ - 1 ) );
|
||||
QString krange =
|
||||
QString( "K=%1-%2" ).arg( QString::number( startIndexK ), QString::number( startIndexK + cellCountK - 1 ) );
|
||||
|
||||
postfix = QString( "%1 %2 %3" ).arg( irange, jrange, krange );
|
||||
}
|
||||
|
||||
return QString( "%1 [%2]" ).arg( RimCellFilter::fullName(), postfix );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -99,7 +132,6 @@ void RimCellRangeFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
if ( changedField != &m_name )
|
||||
{
|
||||
computeAndSetValidValues();
|
||||
|
||||
filterChanged.send();
|
||||
}
|
||||
}
|
||||
|
@@ -60,12 +60,13 @@ public:
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
QString fullName() const override;
|
||||
|
||||
private:
|
||||
void computeAndSetValidValues();
|
||||
|
@@ -1,264 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "cafPdmUiEditorHandle.h"
|
||||
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCellRangeFilterCollection, "CellRangeFilterCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilterCollection::RimCellRangeFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Range Filters", ":/CellFilter_Range.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &rangeFilters, "RangeFilters", "Range Filters", "", "", "" );
|
||||
rangeFilters.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
|
||||
isActive.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilterCollection::~RimCellRangeFilterCollection()
|
||||
{
|
||||
rangeFilters.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// RimCellRangeFilter is using Eclipse 1-based indexing, adjust filter values before
|
||||
// populating cvf::CellRangeFilter (which is 0-based)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const
|
||||
{
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
for ( size_t i = 0; i < rangeFilters.size(); i++ )
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = rangeFilters[i];
|
||||
|
||||
if ( rangeFilter && rangeFilter->isActive() && static_cast<size_t>( rangeFilter->gridIndex() ) == gridIndex )
|
||||
{
|
||||
if ( rangeFilter->filterMode == RimCellFilter::INCLUDE )
|
||||
{
|
||||
if ( rangeFilter->useIndividualCellIndices() )
|
||||
{
|
||||
for ( const auto& cellIndex : rangeFilter->individualCellIndices() )
|
||||
{
|
||||
cellRangeFilter->addCellInclude( cellIndex.x() - 1,
|
||||
cellIndex.y() - 1,
|
||||
cellIndex.z() - 1,
|
||||
rangeFilter->propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellRangeFilter->addCellIncludeRange( rangeFilter->startIndexI - 1,
|
||||
rangeFilter->startIndexJ - 1,
|
||||
rangeFilter->startIndexK - 1,
|
||||
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||
rangeFilter->propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( rangeFilter->useIndividualCellIndices() )
|
||||
{
|
||||
for ( const auto& cellIndex : rangeFilter->individualCellIndices() )
|
||||
{
|
||||
cellRangeFilter->addCellExclude( cellIndex.x() - 1,
|
||||
cellIndex.y() - 1,
|
||||
cellIndex.z() - 1,
|
||||
rangeFilter->propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellRangeFilter->addCellExcludeRange( rangeFilter->startIndexI - 1,
|
||||
rangeFilter->startIndexJ - 1,
|
||||
rangeFilter->startIndexK - 1,
|
||||
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||
rangeFilter->propagateToSubGrids() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
updateIconState();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
updateDisplayModeNotifyManagedViews( nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateDisplayModeNotifyManagedViews( nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::updateDisplayModeNotifyManagedViews( RimCellRangeFilter* changedRangeFilter )
|
||||
{
|
||||
Rim3dView* view = nullptr;
|
||||
firstAncestorOrThisOfType( view );
|
||||
if ( !view ) return;
|
||||
|
||||
if ( view->isMasterView() )
|
||||
{
|
||||
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||
if ( viewLinker )
|
||||
{
|
||||
// Update data for range filter
|
||||
// Update of display model is handled by view->scheduleGeometryRegen, also for managed views
|
||||
viewLinker->updateRangeFilters( changedRangeFilter );
|
||||
}
|
||||
}
|
||||
|
||||
view->scheduleGeometryRegen( VISIBLE_WELL_CELLS );
|
||||
view->scheduleGeometryRegen( RANGE_FILTERED );
|
||||
view->scheduleGeometryRegen( RANGE_FILTERED_INACTIVE );
|
||||
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilterCollection::hasActiveFilters() const
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
for ( size_t i = 0; i < rangeFilters.size(); i++ )
|
||||
{
|
||||
if ( rangeFilters[i]->isActive() ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellRangeFilterCollection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilterCollection::hasActiveIncludeFilters() const
|
||||
{
|
||||
if ( !isActive ) return false;
|
||||
|
||||
for ( size_t i = 0; i < rangeFilters.size(); i++ )
|
||||
{
|
||||
if ( rangeFilters[i]->isActive() && rangeFilters[i]->filterMode() == RimCellFilter::INCLUDE ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView* RimCellRangeFilterCollection::baseView() const
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfType( rimView );
|
||||
|
||||
return rimView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::updateIconState()
|
||||
{
|
||||
bool activeIcon = true;
|
||||
|
||||
RimViewController* viewController = baseView()->viewController();
|
||||
if ( viewController && ( viewController->isRangeFiltersControlled() || viewController->isVisibleCellsOveridden() ) )
|
||||
{
|
||||
activeIcon = false;
|
||||
}
|
||||
|
||||
if ( !isActive )
|
||||
{
|
||||
activeIcon = false;
|
||||
}
|
||||
|
||||
updateUiIconFromState( activeIcon );
|
||||
|
||||
for ( size_t i = 0; i < rangeFilters.size(); i++ )
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = rangeFilters[i];
|
||||
rangeFilter->updateActiveState();
|
||||
rangeFilter->updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
PdmObject::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
||||
|
||||
RimViewController* viewController = baseView()->viewController();
|
||||
if ( viewController && viewController->isRangeFiltersControlled() )
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly( false );
|
||||
}
|
||||
|
||||
updateIconState();
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
};
|
@@ -16,7 +16,7 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimPolygonFilter.h"
|
||||
|
||||
#include "RigCellGeometryTools.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@@ -25,56 +25,59 @@
|
||||
#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 "RiuViewerCommands.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()
|
||||
void caf::AppEnum<RimPolygonFilter::PolygonFilterModeType>::setUp()
|
||||
{
|
||||
addItem( RimPolylineFilter::PolylineFilterModeType::DEPTH_Z, "DEPTH_Z", "Depth" );
|
||||
addItem( RimPolylineFilter::PolylineFilterModeType::INDEX_K, "INDEX_K", "K index" );
|
||||
setDefault( RimPolylineFilter::PolylineFilterModeType::INDEX_K );
|
||||
addItem( RimPolygonFilter::PolygonFilterModeType::DEPTH_Z, "DEPTH_Z", "XY Position" );
|
||||
addItem( RimPolygonFilter::PolygonFilterModeType::INDEX_K, "INDEX_K", "IJ Index" );
|
||||
setDefault( RimPolygonFilter::PolygonFilterModeType::INDEX_K );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimPolylineFilter::PolylineIncludeType>::setUp()
|
||||
void caf::AppEnum<RimPolygonFilter::PolygonIncludeType>::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 );
|
||||
addItem( RimPolygonFilter::PolygonIncludeType::FULL_CELL, "FULL_CELL", "Whole cell inside polygon" );
|
||||
addItem( RimPolygonFilter::PolygonIncludeType::CENTER, "CENTER", "Cell center inside polygon" );
|
||||
addItem( RimPolygonFilter::PolygonIncludeType::ANY, "ANY", "Any corner inside polygon" );
|
||||
setDefault( RimPolygonFilter::PolygonIncludeType::CENTER );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPolylineFilter, "PolyLineFilter" );
|
||||
CAF_PDM_SOURCE_INIT( RimPolygonFilter, "PolygonFilter", "PolyLineFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineFilter::RimPolylineFilter()
|
||||
RimPolygonFilter::RimPolygonFilter()
|
||||
: m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
{
|
||||
CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polyline.png", "", "" );
|
||||
CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polygon.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_polyFilterMode, "PolylineFilterType", "Depth Type", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_polyFilterMode, "PolygonFilterType", "Vertical Filter", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_polyIncludeType, "PolyIncludeType", "Cells to include", "", "", "" );
|
||||
|
||||
@@ -101,14 +104,14 @@ RimPolylineFilter::RimPolylineFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineFilter::~RimPolylineFilter()
|
||||
RimPolygonFilter::~RimPolygonFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateVisualization()
|
||||
void RimPolygonFilter::updateVisualization()
|
||||
{
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
@@ -117,7 +120,7 @@ void RimPolylineFilter::updateVisualization()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::initAfterRead()
|
||||
void RimPolygonFilter::initAfterRead()
|
||||
{
|
||||
resolveReferencesRecursively();
|
||||
}
|
||||
@@ -125,7 +128,7 @@ void RimPolylineFilter::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateEditorsAndVisualization()
|
||||
void RimPolygonFilter::updateEditorsAndVisualization()
|
||||
{
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
@@ -134,7 +137,7 @@ void RimPolylineFilter::updateEditorsAndVisualization()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::setCase( RimCase* srcCase )
|
||||
void RimPolygonFilter::setCase( RimCase* srcCase )
|
||||
{
|
||||
m_srcCase = srcCase;
|
||||
}
|
||||
@@ -142,7 +145,15 @@ void RimPolylineFilter::setCase( RimCase* srcCase )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylineTarget*> RimPolylineFilter::activeTargets() const
|
||||
QString RimPolygonFilter::fullName() const
|
||||
{
|
||||
return QString( "%1 [%2 cells]" ).arg( RimCellFilter::fullName(), QString::number( m_cells.size() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylineTarget*> RimPolygonFilter::activeTargets() const
|
||||
{
|
||||
return m_targets.childObjects();
|
||||
}
|
||||
@@ -150,7 +161,7 @@ std::vector<RimPolylineTarget*> RimPolylineFilter::activeTargets() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert )
|
||||
void RimPolygonFilter::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert )
|
||||
{
|
||||
size_t index = m_targets.index( targetToInsertBefore );
|
||||
if ( index < m_targets.size() )
|
||||
@@ -164,9 +175,18 @@ void RimPolylineFilter::insertTarget( const RimPolylineTarget* targetToInsertBef
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
void RimPolygonFilter::deleteTarget( RimPolylineTarget* targetToDelete )
|
||||
{
|
||||
m_targets.removeChildObject( targetToDelete );
|
||||
delete targetToDelete;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonFilter::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_enablePicking )
|
||||
{
|
||||
@@ -203,7 +223,21 @@ void RimPolylineFilter::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
void RimPolygonFilter::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu,
|
||||
QMenu* menu,
|
||||
QWidget* fieldEditorWidget )
|
||||
{
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicDeletePolylineTargetFeature";
|
||||
|
||||
menuBuilder.appendToMenu( menu );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimCellFilter::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
@@ -220,9 +254,9 @@ void RimPolylineFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
void RimPolygonFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_enablePicking )
|
||||
{
|
||||
@@ -231,11 +265,6 @@ void RimPolylineFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
if ( m_enablePicking() )
|
||||
{
|
||||
setActive( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
setActive( true );
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
}
|
||||
}
|
||||
@@ -250,7 +279,7 @@ void RimPolylineFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::enablePicking( bool enable )
|
||||
void RimPolygonFilter::enablePicking( bool enable )
|
||||
{
|
||||
m_enablePicking = enable;
|
||||
updateConnectedEditors();
|
||||
@@ -259,7 +288,7 @@ void RimPolylineFilter::enablePicking( bool enable )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylineFilter::pickingEnabled() const
|
||||
bool RimPolygonFilter::pickingEnabled() const
|
||||
{
|
||||
return m_enablePicking();
|
||||
}
|
||||
@@ -267,7 +296,7 @@ bool RimPolylineFilter::pickingEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PickEventHandler* RimPolylineFilter::pickEventHandler() const
|
||||
caf::PickEventHandler* RimPolygonFilter::pickEventHandler() const
|
||||
{
|
||||
return m_pickTargetsEventHandler.get();
|
||||
}
|
||||
@@ -275,7 +304,7 @@ caf::PickEventHandler* RimPolylineFilter::pickEventHandler() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter )
|
||||
void RimPolygonFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter )
|
||||
{
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
@@ -301,14 +330,14 @@ void RimPolylineFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylineFilter::cellInsidePolygon2D( cvf::Vec3d center,
|
||||
std::array<cvf::Vec3d, 8>& corners,
|
||||
std::vector<cvf::Vec3d> polygon )
|
||||
bool RimPolygonFilter::cellInsidePolygon2D( cvf::Vec3d center,
|
||||
std::array<cvf::Vec3d, 8>& corners,
|
||||
std::vector<cvf::Vec3d> polygon )
|
||||
{
|
||||
bool bInside = false;
|
||||
switch ( m_polyIncludeType() )
|
||||
{
|
||||
case PolylineIncludeType::ANY:
|
||||
case PolygonIncludeType::ANY:
|
||||
// any part of the cell is inside
|
||||
for ( const auto& point : corners )
|
||||
{
|
||||
@@ -316,11 +345,11 @@ bool RimPolylineFilter::cellInsidePolygon2D( cvf::Vec3d center,
|
||||
}
|
||||
break;
|
||||
|
||||
case PolylineIncludeType::CENTER:
|
||||
case PolygonIncludeType::CENTER:
|
||||
// cell center is inside
|
||||
return RigCellGeometryTools::pointInsidePolygon2D( center, polygon );
|
||||
|
||||
case PolylineIncludeType::FULL_CELL:
|
||||
case PolygonIncludeType::FULL_CELL:
|
||||
// entire cell is inside
|
||||
bInside = true;
|
||||
for ( const auto& point : corners )
|
||||
@@ -336,7 +365,7 @@ bool RimPolylineFilter::cellInsidePolygon2D( cvf::Vec3d center,
|
||||
return bInside;
|
||||
}
|
||||
|
||||
void RimPolylineFilter::updateCellsDepthEclipse( const std::vector<cvf::Vec3d>& points, const RigMainGrid* grid )
|
||||
void RimPolygonFilter::updateCellsDepthEclipse( const std::vector<cvf::Vec3d>& points, const RigMainGrid* grid )
|
||||
{
|
||||
// we should look in depth using Z coordinate
|
||||
// loop over all cells
|
||||
@@ -364,7 +393,7 @@ void RimPolylineFilter::updateCellsDepthEclipse( const std::vector<cvf::Vec3d>&
|
||||
// 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 )
|
||||
void RimPolygonFilter::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;
|
||||
@@ -445,7 +474,7 @@ void RimPolylineFilter::updateCellsKIndexEclipse( const std::vector<cvf::Vec3d>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsForEclipse( const std::vector<cvf::Vec3d>& points, RimEclipseCase* eCase )
|
||||
void RimPolygonFilter::updateCellsForEclipse( const std::vector<cvf::Vec3d>& points, RimEclipseCase* eCase )
|
||||
{
|
||||
RigEclipseCaseData* data = eCase->eclipseCaseData();
|
||||
if ( !data ) return;
|
||||
@@ -453,11 +482,11 @@ void RimPolylineFilter::updateCellsForEclipse( const std::vector<cvf::Vec3d>& po
|
||||
RigMainGrid* grid = data->mainGrid();
|
||||
if ( !grid ) return;
|
||||
|
||||
if ( m_polyFilterMode == PolylineFilterModeType::DEPTH_Z )
|
||||
if ( m_polyFilterMode == PolygonFilterModeType::DEPTH_Z )
|
||||
{
|
||||
updateCellsDepthEclipse( points, grid );
|
||||
}
|
||||
else if ( m_polyFilterMode == PolylineFilterModeType::INDEX_K )
|
||||
else if ( m_polyFilterMode == PolygonFilterModeType::INDEX_K )
|
||||
{
|
||||
updateCellsKIndexEclipse( points, grid );
|
||||
}
|
||||
@@ -466,7 +495,7 @@ void RimPolylineFilter::updateCellsForEclipse( const std::vector<cvf::Vec3d>& po
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>& points, const RigFemPartGrid* grid )
|
||||
void RimPolygonFilter::updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>& points, const RigFemPartGrid* grid )
|
||||
{
|
||||
// we should look in depth using Z coordinate
|
||||
// loop over all cells
|
||||
@@ -503,7 +532,7 @@ void RimPolylineFilter::updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>&
|
||||
// 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 )
|
||||
void RimPolygonFilter::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;
|
||||
@@ -589,17 +618,17 @@ void RimPolylineFilter::updateCellsKIndexGeoMech( const std::vector<cvf::Vec3d>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCellsForGeoMech( const std::vector<cvf::Vec3d>& points, RimGeoMechCase* gCase )
|
||||
void RimPolygonFilter::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 )
|
||||
if ( m_polyFilterMode == PolygonFilterModeType::DEPTH_Z )
|
||||
{
|
||||
updateCellsDepthGeoMech( points, grid );
|
||||
}
|
||||
else if ( m_polyFilterMode == PolylineFilterModeType::INDEX_K )
|
||||
else if ( m_polyFilterMode == PolygonFilterModeType::INDEX_K )
|
||||
{
|
||||
updateCellsKIndexGeoMech( points, grid );
|
||||
}
|
||||
@@ -609,7 +638,7 @@ void RimPolylineFilter::updateCellsForGeoMech( const std::vector<cvf::Vec3d>& po
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Update the cell index list with the cells that are inside our polygon, if any
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineFilter::updateCells()
|
||||
void RimPolygonFilter::updateCells()
|
||||
{
|
||||
// reset
|
||||
m_cells.clear();
|
@@ -44,32 +44,33 @@ class RigFemPartGrid;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylineFilter : public RimCellFilter, public RimPolylinePickerInterface
|
||||
class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class PolylineFilterModeType
|
||||
enum class PolygonFilterModeType
|
||||
{
|
||||
DEPTH_Z,
|
||||
INDEX_K
|
||||
};
|
||||
|
||||
enum class PolylineIncludeType
|
||||
enum class PolygonIncludeType
|
||||
{
|
||||
FULL_CELL,
|
||||
CENTER,
|
||||
ANY
|
||||
};
|
||||
|
||||
RimPolylineFilter();
|
||||
~RimPolylineFilter() override;
|
||||
RimPolygonFilter();
|
||||
~RimPolygonFilter() override;
|
||||
|
||||
void setCase( RimCase* srcCase );
|
||||
|
||||
void updateVisualization() override;
|
||||
void updateEditorsAndVisualization() override;
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
|
||||
void deleteTarget( RimPolylineTarget* targetToDelete ) override;
|
||||
void enablePicking( bool enable );
|
||||
|
||||
std::vector<RimPolylineTarget*> activeTargets() const override;
|
||||
@@ -83,7 +84,10 @@ protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
QString fullName() const override;
|
||||
|
||||
private:
|
||||
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
@@ -99,11 +103,11 @@ private:
|
||||
|
||||
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;
|
||||
caf::PdmField<bool> m_enablePicking;
|
||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||
caf::PdmField<caf::AppEnum<PolygonFilterModeType>> m_polyFilterMode;
|
||||
caf::PdmField<caf::AppEnum<PolygonIncludeType>> m_polyIncludeType;
|
||||
caf::PdmPtrField<RimCase*> m_srcCase;
|
||||
|
||||
std::shared_ptr<RicPolylineTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimUserDefinedFilter.h"
|
||||
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimUserDefinedFilter, "UserDefinedFilter" );
|
||||
@@ -45,6 +46,14 @@ RimUserDefinedFilter::~RimUserDefinedFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimUserDefinedFilter::fullName() const
|
||||
{
|
||||
return QString( "%1 [%2 cells]" ).arg( RimCellFilter::fullName(), QString::number( m_individualCellIndices().size() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -40,8 +40,9 @@ public:
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter ) override;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
QString fullName() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<cvf::Vec3d>> m_individualCellIndices;
|
||||
|
@@ -945,7 +945,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if ( dynamic_cast<RimCellFilterCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewPolylineFilterFeature";
|
||||
menuBuilder << "RicNewPolygonFilterFeature";
|
||||
menuBuilder << "RicNewUserDefinedFilterFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewCellRangeFilterFeature";
|
||||
|
@@ -27,6 +27,7 @@ class RimPolylinePickerInterface
|
||||
{
|
||||
public:
|
||||
virtual void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) = 0;
|
||||
virtual void deleteTarget( RimPolylineTarget* targetToDelete ) = 0;
|
||||
virtual void updateEditorsAndVisualization() = 0;
|
||||
virtual void updateVisualization() = 0;
|
||||
virtual std::vector<RimPolylineTarget*> activeTargets() const = 0;
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimPolylineFilter.h"
|
||||
#include "RimPolygonFilter.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
@@ -1032,7 +1032,7 @@ void RimViewController::updateCellFilterOverrides( const RimCellFilter* changedF
|
||||
continue;
|
||||
}
|
||||
|
||||
RimPolylineFilter* polyDstFilter = dynamic_cast<RimPolylineFilter*>( dstFilters[rfIdx] );
|
||||
RimPolygonFilter* polyDstFilter = dynamic_cast<RimPolygonFilter*>( dstFilters[rfIdx] );
|
||||
if ( polyDstFilter != nullptr )
|
||||
{
|
||||
RimGeoMechCase* gCase = depGeomView->geoMechCase();
|
||||
@@ -1063,7 +1063,7 @@ void RimViewController::updateCellFilterOverrides( const RimCellFilter* changedF
|
||||
continue;
|
||||
}
|
||||
|
||||
RimPolylineFilter* polyDstFilter = dynamic_cast<RimPolylineFilter*>( dstFilters[rfIdx] );
|
||||
RimPolygonFilter* polyDstFilter = dynamic_cast<RimPolygonFilter*>( dstFilters[rfIdx] );
|
||||
if ( polyDstFilter != nullptr )
|
||||
{
|
||||
RimEclipseCase* eCase = depEclView->eclipseCase();
|
||||
@@ -1079,7 +1079,7 @@ void RimViewController::updateCellFilterOverrides( const RimCellFilter* changedF
|
||||
{
|
||||
overrideFilterColl->connectToFilterUpdates( dstFilters[rfIdx] );
|
||||
|
||||
RimPolylineFilter* polyDstFilter = dynamic_cast<RimPolylineFilter*>( dstFilters[rfIdx] );
|
||||
RimPolygonFilter* polyDstFilter = dynamic_cast<RimPolygonFilter*>( dstFilters[rfIdx] );
|
||||
if ( polyDstFilter != nullptr )
|
||||
{
|
||||
RimCase* theCase = nullptr;
|
||||
|
@@ -403,7 +403,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
|
||||
menuBuilder << "RicNewPolylineFilter3dviewFeature";
|
||||
menuBuilder << "RicNewPolygonFilter3dviewFeature";
|
||||
|
||||
menuBuilder << "RicEclipsePropertyFilterNewInViewFeature";
|
||||
menuBuilder << "RicGeoMechPropertyFilterNewInViewFeature";
|
||||
|
Reference in New Issue
Block a user