Skip to content

Commit

Permalink
#6145: Declare some interfaces needed to move the SelectionTestWalker…
Browse files Browse the repository at this point in the history
… creation to a central location
  • Loading branch information
codereader committed Oct 30, 2022
1 parent 809c5a3 commit fc2ab0d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
1 change: 0 additions & 1 deletion include/iselection.h
Expand Up @@ -2,7 +2,6 @@

#include <cstddef>
#include "imodule.h"
#include "ivolumetest.h"
#include <memory>
#include <sigc++/signal.h>
#include "imanipulator.h"
Expand Down
41 changes: 41 additions & 0 deletions include/iselectiontest.h
Expand Up @@ -337,3 +337,44 @@ typedef std::shared_ptr<PlaneSelectable> PlaneSelectablePtr;
inline PlaneSelectablePtr Node_getPlaneSelectable(const scene::INodePtr& node) {
return std::dynamic_pointer_cast<PlaneSelectable>(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<ISceneSelectionTester>;

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

0 comments on commit fc2ab0d

Please sign in to comment.