From fc2ab0ddb40eca72cc94c351dd5f28f5901129eb Mon Sep 17 00:00:00 2001 From: codereader Date: Sun, 30 Oct 2022 17:50:31 +0100 Subject: [PATCH] #6145: Declare some interfaces needed to move the SelectionTestWalker creation to a central location --- include/iselection.h | 1 - include/iselectiontest.h | 41 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/iselection.h b/include/iselection.h index 3b1a8e4948..37ed62c1e9 100644 --- a/include/iselection.h +++ b/include/iselection.h @@ -2,7 +2,6 @@ #include #include "imodule.h" -#include "ivolumetest.h" #include #include #include "imanipulator.h" diff --git a/include/iselectiontest.h b/include/iselectiontest.h index b578fd0dab..5a735ae7eb 100644 --- a/include/iselectiontest.h +++ b/include/iselectiontest.h @@ -337,3 +337,44 @@ typedef std::shared_ptr PlaneSelectablePtr; inline PlaneSelectablePtr Node_getPlaneSelectable(const scene::INodePtr& node) { return std::dynamic_pointer_cast(node); } + +namespace selection +{ + +/** + * Interface of a scene walker that can be used to test + * some or all nodes of the scene for selection. + * + * All qualified scene nodes are tested for selection and + * added to the given Selector instance (which in turn can + * accept or reject the selectable based on its own logic). + */ +class ISceneSelectionTester +{ +public: + using Ptr = std::shared_ptr; + + virtual ~ISceneSelectionTester() {} + + // Test all qualified nodes in the scene for selection + // and add the ones passing the test to the given selector. + virtual void testSelectScene(Selector& selector) = 0; +}; + +/** + * Factory interface used to acquire ISceneSelectionTester + * instances suitable for a given purpose. + */ +class ISelectionTesterProvider +{ +public: + virtual ~ISelectionTesterProvider() {} + + /** + * Returns an instance of a selection tester suitable for testing + * scene nodes according to the given purpose/selection mode. + */ + virtual ISceneSelectionTester::Ptr createSceneSelectionTester(SelectionSystem::EMode mode) = 0; +}; + +} // namespace