Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cell filter to use global polygons #11213

Closed
wants to merge 12 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

#include "RicNewPolygonFilter3dviewFeature.h"

#include "Polygons/RimPolygonInView.h"

#include "RiaApplication.h"
#include "RicNewPolygonFilterFeature.h"

#include "RimCase.h"
#include "RimCellFilterCollection.h"
#include "RimGridView.h"
Expand All @@ -37,20 +41,13 @@ CAF_CMD_SOURCE_INIT( RicNewPolygonFilter3dviewFeature, "RicNewPolygonFilter3dvie
//--------------------------------------------------------------------------------------------------
void RicNewPolygonFilter3dviewFeature::onActionTriggered( bool isChecked )
{
// Get the selected Cell Filter Collection
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( !viewOrComparisonView ) return;

RimCellFilterCollection* filtColl = viewOrComparisonView->cellFilterCollection();

// and the case to use
RimCase* sourceCase = viewOrComparisonView->ownerCase();
RimCellFilterCollection* filtColl = viewOrComparisonView->cellFilterCollection();
RimCase* sourceCase = viewOrComparisonView->ownerCase();

RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
}
RicNewPolygonFilterFeature::appendNewPolygonFilter( sourceCase, filtColl );
}

//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@

#include "RicNewPolygonFilterFeature.h"

#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonInView.h"
#include "Polygons/RimPolygonTools.h"

#include "RimCase.h"
#include "RimCellFilterCollection.h"
#include "RimPolygonFilter.h"

#include "Riu3DMainWindowTools.h"

#include "cafSelectionManagerTools.h"
Expand All @@ -30,24 +35,42 @@

CAF_CMD_SOURCE_INIT( RicNewPolygonFilterFeature, "RicNewPolygonFilterFeature" );

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPolygonFilter* RicNewPolygonFilterFeature::appendNewPolygonFilter( RimCase* sourceCase, RimCellFilterCollection* cellFilterCollection )
{
if ( !sourceCase || !cellFilterCollection )
{
return nullptr;
}

RimPolygonFilter* polygonFilter = cellFilterCollection->addNewPolygonFilter( sourceCase );
if ( polygonFilter )
{
auto polygon = RimPolygonTools::createNewPolygon();
polygon->setIsClosed( true );
polygonFilter->setPolygon( polygon );

RimPolygonTools::selectPolygonInView( polygon, polygonFilter );
return polygonFilter;
}

return nullptr;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
{
// Find the selected Cell Filter Collection
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
if ( colls.empty() ) return;
RimCellFilterCollection* filtColl = colls[0];

// and the case to use
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();

RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
}
appendNewPolygonFilter( sourceCase, filtColl );
}

//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@

#include "cafCmdFeature.h"

class RimCellFilterCollection;
class RimCase;
class RimPolygonFilter;

//==================================================================================================
///
//==================================================================================================
class RicNewPolygonFilterFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

public:
static RimPolygonFilter* appendNewPolygonFilter( RimCase* sourceCase, RimCellFilterCollection* cellFilterCollection );

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor ASA
// Copyright (C) 2024 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDuplicateWellPathFeature.h
)

Expand Down Expand Up @@ -66,7 +65,6 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDuplicateWellPathFeature.cpp
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "RicPointTangentManipulator.h"

#include "Rim3dView.h"
#include "RimPolylinePickerInterface.h"
#include "RimPolylineTarget.h"

#include "RiuViewer.h"
Expand Down Expand Up @@ -96,8 +97,13 @@ void RicPolylineTarget3dEditor::configureAndUpdateUi( const QString& uiConfigNam

cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();

const double handleScalingFactor = 0.7;
const double handleSize = handleScalingFactor * view->characteristicCellSize();
double scalingFactor = 0.7;
if ( auto pickerInterface = target->firstAncestorOrThisOfType<RimPolylinePickerInterface>() )
{
scalingFactor *= pickerInterface->handleScalingFactor();
}

const double handleSize = scalingFactor * view->characteristicCellSize();

m_manipulator->setOrigin( dispXf->transformToDisplayCoord( target->targetPointXYZ() ) );
m_manipulator->setHandleSize( handleSize );
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions ApplicationLibCode/ModelVisualization/CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RivWellDiskPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivElementVectorResultPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivPolylinePartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivCellFilterPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivDrawableSpheres.h
${CMAKE_CURRENT_LIST_DIR}/RivBoxGeometryGenerator.h
${CMAKE_CURRENT_LIST_DIR}/RivAnnotationTools.h
Expand Down Expand Up @@ -112,7 +111,6 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RivWellDiskPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivElementVectorResultPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivPolylinePartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivCellFilterPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivDrawableSpheres.cpp
${CMAKE_CURRENT_LIST_DIR}/RivBoxGeometryGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/RivAnnotationTools.cpp
Expand Down
88 changes: 0 additions & 88 deletions ApplicationLibCode/ModelVisualization/RivCellFilterPartMgr.cpp

This file was deleted.

Loading
Loading