mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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:
@@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimUserDefinedFilter : public RimCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimUserDefinedFilter();
|
||||
~RimUserDefinedFilter() override;
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user