mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3296 caf::SelectionManager: Refactoring to avoid sending multiple selection changes
Must be considered if using the CmdSelectionGangeExec
This commit is contained in:
@@ -107,6 +107,7 @@ bool RicPointTangentManipulator::eventFilter(QObject *obj, QEvent* inputEvent)
|
||||
|
||||
if(m_partManager->isManipulatorActive())
|
||||
{
|
||||
emit notifySelected();
|
||||
emit notifyRedraw();
|
||||
|
||||
return true;
|
||||
@@ -307,7 +308,6 @@ void RicPointTangentManipulatorPartMgr::tryToActivateManipulator(const cvf::HitI
|
||||
m_tangentOnStartManipulation = m_tangent;
|
||||
m_originOnStartManipulation = m_origin;
|
||||
m_currentHandleIndex = i;
|
||||
caf::SelectionManager::instance()->clear(caf::SelectionManager::FIRST_LEVEL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,9 +639,9 @@ PdmUiSelectionVisualizer3d::~PdmUiSelectionVisualizer3d()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiSelectionVisualizer3d::onSelectionManagerSelectionChanged(int selectionLevel)
|
||||
void PdmUiSelectionVisualizer3d::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
|
||||
{
|
||||
if (selectionLevel != 0) return;
|
||||
if (!changedSelectionLevels.count(0)) return;
|
||||
|
||||
for (auto editor: m_active3DEditors)
|
||||
{
|
||||
@@ -805,6 +805,10 @@ void RicWellTarget3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifySelected() ),
|
||||
this,
|
||||
SLOT( slotSelectedIn3D() ) );
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
m_ownerViewer->addStaticModelOnce(m_cvfModel.p());
|
||||
}
|
||||
@@ -873,3 +877,14 @@ void RicWellTarget3dEditor::slotUpdated(const cvf::Vec3d& origin, const cvf::Vec
|
||||
std::cout << "RicWellTarget3dEditor::slotUpdated() end" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void RicWellTarget3dEditor::slotSelectedIn3D()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItemAtLevel(target, caf::SelectionManager::FIRST_LEVEL);
|
||||
}
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
void appendPartsToModel(cvf::ModelBasicList* model);
|
||||
|
||||
signals:
|
||||
void notifySelected();
|
||||
void notifyRedraw();
|
||||
void notifyUpdate(const cvf::Vec3d& origin, const cvf::Vec3d& tangent);
|
||||
|
||||
@@ -229,7 +230,7 @@ public:
|
||||
PdmUiSelectionVisualizer3d(caf::Viewer* ownerViewer);
|
||||
~PdmUiSelectionVisualizer3d();
|
||||
protected:
|
||||
virtual void onSelectionManagerSelectionChanged(int selectionLevel) override;
|
||||
virtual void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;
|
||||
|
||||
std::vector< QPointer<PdmUi3dObjectEditorHandle> > m_active3DEditors;
|
||||
|
||||
@@ -284,6 +285,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent);
|
||||
void slotSelectedIn3D();
|
||||
private:
|
||||
QPointer<RicPointTangentManipulator> m_manipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
|
||||
Reference in New Issue
Block a user