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

Prototype polygon editor as child object of cell filter #11208

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "RicNewPolygonFilter3dviewFeature.h"

#include "Polygons/RimPolygonInView.h"

#include "RiaApplication.h"
#include "RimCase.h"
#include "RimCellFilterCollection.h"
Expand Down Expand Up @@ -49,7 +51,7 @@ void RicNewPolygonFilter3dviewFeature::onActionTriggered( bool isChecked )
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated->polygonEditor() );
}
}

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

#include "RicNewPolygonFilterFeature.h"

#include "Polygons/RimPolygonInView.h"

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

#include "Riu3DMainWindowTools.h"

#include "cafSelectionManagerTools.h"
Expand All @@ -46,7 +49,7 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated->polygonEditor() );
}
}

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.

This file was deleted.

38 changes: 2 additions & 36 deletions ApplicationLibCode/ModelVisualization/RivCellFilterPartMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include "RimCellFilterCollection.h"
#include "RimPolygonFilter.h"

#include "RivPolylinePartMgr.h"

#include "cafPdmObject.h"

//--------------------------------------------------------------------------------------------------
Expand All @@ -34,55 +32,23 @@ RivCellFilterPartMgr::RivCellFilterPartMgr( Rim3dView* view )
{
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivCellFilterPartMgr::~RivCellFilterPartMgr()
{
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivCellFilterPartMgr::appendGeometryPartsToModel( cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& boundingBox )
{
createCellFilterPartManagers();

for ( auto& partMgr : m_cellFilterPartMgrs )
{
partMgr->appendDynamicGeometryPartsToModel( model, displayCoordTransform, boundingBox );
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivCellFilterPartMgr::createCellFilterPartManagers()
{
std::vector<RimCellFilterCollection*> colls = m_rimView->descendantsIncludingThisOfType<RimCellFilterCollection>();

if ( colls.empty() ) return;
auto coll = colls.front();

clearGeometryCache();

for ( auto filter : coll->filters() )
{
RimPolygonFilter* polyFilter = dynamic_cast<RimPolygonFilter*>( filter );
if ( polyFilter )
if ( auto polyFilter = dynamic_cast<RimPolygonFilter*>( filter ) )
{
RivPolylinePartMgr* ppm = new RivPolylinePartMgr( m_rimView, polyFilter, coll );
m_cellFilterPartMgrs.push_back( ppm );
polyFilter->appendPartsToModel( model, displayCoordTransform, boundingBox );
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivCellFilterPartMgr::clearGeometryCache()
{
m_cellFilterPartMgrs.clear();
}
12 changes: 1 addition & 11 deletions ApplicationLibCode/ModelVisualization/RivCellFilterPartMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#pragma once

#include "cafPdmPointer.h"
#include "cvfAssert.h"
#include "cvfCollection.h"
#include "cvfObject.h"

namespace cvf
Expand All @@ -37,24 +35,16 @@ class DisplayCoordTransform;
}

class Rim3dView;
class RivPolylinePartMgr;

class RivCellFilterPartMgr : public cvf::Object
{
public:
RivCellFilterPartMgr( Rim3dView* view );
~RivCellFilterPartMgr() override;

void appendGeometryPartsToModel( cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& boundingBox );

void clearGeometryCache();

private:
void createCellFilterPartManagers();

private:
caf::PdmPointer<Rim3dView> m_rimView;
cvf::Collection<RivPolylinePartMgr> m_cellFilterPartMgrs;
caf::PdmPointer<Rim3dView> m_rimView;
};
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ RimPolygonFilter* RimCellFilterCollection::addNewPolygonFilter( RimCase* srcCase
RimPolygonFilter* pFilter = new RimPolygonFilter();
pFilter->setCase( srcCase );
addFilter( pFilter );
pFilter->configurePolygonEditor();
pFilter->enablePicking( true );
onFilterUpdated( pFilter );
return pFilter;
Expand Down
Loading
Loading