VTK  9.7.20260824
vtkScivisSelector Class Reference

#include <vtkScivisSelector.h>

Detailed Description

Selection for a vtkScivisView.

vtkScivisSelector is the part of a render view that turns a region of the screen into a selection: how the region is interpreted, whether points or cells come back, and what was picked last. A view owns one and hands it out through vtkScivisView::GetSelector(), which keeps selection in one place instead of spread across the view's own API.

Example usage:
view->GetSelector()->SetModeToFrustum();
view->GetSelector()->SelectCells();
view->GetSelector()->SelectRegion(10, 10, 200, 200);
vtkSelection* picked = view->GetSelector()->GetCurrentSelection();
data object that represents a "selection" in VTK.
The same in Python:
view.selector.mode = "frustum"
view.selector.SelectCells()
view.selector.SelectRegion(10, 10, 200, 200)
picked = view.selector.current_selection

Interaction is not here: which interactor style is installed, and therefore whether a drag draws a rubber band at all, belongs to the view. This object is what a rubber band drives, and what application code drives directly when it wants a selection without one.

See also
vtkScivisView vtkSelection vtkHardwareSelector
Events:
vtkCommand::SelectionChangedEvent
Examples:
vtkScivisSelector (Examples)
Tests:
vtkScivisSelector (Tests)

Definition at line 62 of file vtkScivisSelector.h.

Inheritance diagram for vtkScivisSelector:
[legend]
Collaboration diagram for vtkScivisSelector:
[legend]

Public Types

typedef vtkObject Superclass

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class.
vtkScivisSelectorNewInstance () const
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
void SelectRegion (int x0, int y0, int x1, int y1, bool extend=false)
 Select the screen-space region bounded by the two corner points, exactly as an interactive rubber-band drag would.
void Clear ()
 Drop the current selection, on every representation in the view.
virtual vtkSelectionGetCurrentSelection ()
 What the last selection picked, or null if nothing has been selected.
void SetFieldAssociation (int assoc)
 Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.
virtual int GetFieldAssociation ()
 Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.
void SelectCells ()
 Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.
void SelectPoints ()
 Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.
void SetView (vtkScivisView *view)
 The view this selects in.
vtkScivisViewGetView ()
 The view this selects in.
Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
virtual void DebugOn ()
 Turn debugging output on.
virtual void DebugOff ()
 Turn debugging output off.
bool GetDebug ()
 Get the value of the debug flag.
void SetDebug (bool debugFlag)
 Set the value of the debug flag.
virtual void Modified ()
 Update the modification time for this object.
virtual vtkMTimeType GetMTime ()
 Return this object's modified time.
void RemoveObserver (unsigned long tag)
void RemoveObservers (unsigned long event)
void RemoveObservers (const char *event)
void RemoveAllObservers ()
vtkTypeBool HasObserver (unsigned long event)
vtkTypeBool HasObserver (const char *event)
vtkTypeBool InvokeEvent (unsigned long event)
vtkTypeBool InvokeEvent (const char *event)
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output.
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
template<class U, class T>
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
template<class U, class T>
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
template<class U, class T>
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method.
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes.
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes.
Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
virtual void Delete ()
 Delete a VTK object.
virtual void FastDelete ()
 Delete a reference to this object.
void InitializeObjectBase ()
void Print (ostream &os)
 Print an object to an ostream.
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
int GetReferenceCount ()
 Return the current reference count of this object.
void SetReferenceCount (int)
 Sets the reference count.
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not.

Static Public Member Functions

static vtkScivisSelectorNew ()
static vtkTypeBool IsTypeOf (const char *type)
static vtkScivisSelectorSafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
static void BreakOnError ()
 This method is called when vtkErrorMacro executes.
static void SetGlobalWarningDisplay (vtkTypeBool val)
 This is a global flag that controls whether any debug, warning or error messages are displayed.
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
static vtkTypeBool GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 vtkScivisSelector ()
 ~vtkScivisSelector () override
Protected Member Functions inherited from vtkObject
 vtkObject ()
 ~vtkObject () override
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events.
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events.
Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
virtual ~vtkObjectBase ()
virtual void ReportReferences (vtkGarbageCollector *)
 vtkObjectBase (const vtkObjectBase &)
void operator= (const vtkObjectBase &)
enum  SelectionModeType { SURFACE = 0 , FRUSTUM = 1 }
 How a screen region becomes a selection. More...
virtual void SetMode (int)
 How a screen region becomes a selection.
virtual int GetMode ()
 How a screen region becomes a selection.
void SetModeToSurface ()
 How a screen region becomes a selection.
void SetModeToFrustum ()
 How a screen region becomes a selection.

Additional Inherited Members

Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
static vtkReallocingFunction GetCurrentReallocFunction ()
static vtkFreeingFunction GetCurrentFreeFunction ()
static vtkFreeingFunction GetAlternateFreeFunction ()
Protected Attributes inherited from vtkObject
bool Debug
vtkTimeStamp MTime
vtkSubjectHelper * SubjectHelper
std::string ObjectName
Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
vtkWeakPointerBase ** WeakPointers

Member Typedef Documentation

◆ Superclass

Definition at line 66 of file vtkScivisSelector.h.

Member Enumeration Documentation

◆ SelectionModeType

How a screen region becomes a selection.

SURFACE picks what is visible, through vtkHardwareSelector, so nothing behind anything else is selected. FRUSTUM selects everything inside the viewing frustum the region describes, whether it can be seen or not. Default is SURFACE.

Enumerator
SURFACE 
FRUSTUM 

Definition at line 78 of file vtkScivisSelector.h.

Constructor & Destructor Documentation

◆ vtkScivisSelector()

vtkScivisSelector::vtkScivisSelector ( )
protected

◆ ~vtkScivisSelector()

vtkScivisSelector::~vtkScivisSelector ( )
overrideprotected

Member Function Documentation

◆ New()

vtkScivisSelector * vtkScivisSelector::New ( )
static

◆ IsTypeOf()

vtkTypeBool vtkScivisSelector::IsTypeOf ( const char * type)
static

◆ IsA()

virtual vtkTypeBool vtkScivisSelector::IsA ( const char * name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

vtkScivisSelector * vtkScivisSelector::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkScivisSelector::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkScivisSelector * vtkScivisSelector::NewInstance ( ) const

◆ PrintSelf()

void vtkScivisSelector::PrintSelf ( ostream & os,
vtkIndent indent )
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ SetMode()

virtual void vtkScivisSelector::SetMode ( int )
virtual

How a screen region becomes a selection.

SURFACE picks what is visible, through vtkHardwareSelector, so nothing behind anything else is selected. FRUSTUM selects everything inside the viewing frustum the region describes, whether it can be seen or not. Default is SURFACE.

◆ GetMode()

virtual int vtkScivisSelector::GetMode ( )
virtual

How a screen region becomes a selection.

SURFACE picks what is visible, through vtkHardwareSelector, so nothing behind anything else is selected. FRUSTUM selects everything inside the viewing frustum the region describes, whether it can be seen or not. Default is SURFACE.

◆ SetModeToSurface()

void vtkScivisSelector::SetModeToSurface ( )
inline

How a screen region becomes a selection.

SURFACE picks what is visible, through vtkHardwareSelector, so nothing behind anything else is selected. FRUSTUM selects everything inside the viewing frustum the region describes, whether it can be seen or not. Default is SURFACE.

Definition at line 85 of file vtkScivisSelector.h.

◆ SetModeToFrustum()

void vtkScivisSelector::SetModeToFrustum ( )
inline

How a screen region becomes a selection.

SURFACE picks what is visible, through vtkHardwareSelector, so nothing behind anything else is selected. FRUSTUM selects everything inside the viewing frustum the region describes, whether it can be seen or not. Default is SURFACE.

Definition at line 86 of file vtkScivisSelector.h.

◆ SetFieldAssociation()

void vtkScivisSelector::SetFieldAssociation ( int assoc)

Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.

SelectCells() and SelectPoints() are the same thing said more plainly.

◆ GetFieldAssociation()

virtual int vtkScivisSelector::GetFieldAssociation ( )
virtual

Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.

SelectCells() and SelectPoints() are the same thing said more plainly.

◆ SelectCells()

void vtkScivisSelector::SelectCells ( )

Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.

SelectCells() and SelectPoints() are the same thing said more plainly.

◆ SelectPoints()

void vtkScivisSelector::SelectPoints ( )

Whether cells or points are selected: one of vtkDataObject::FIELD_ASSOCIATION_CELLS, the default, or vtkDataObject::FIELD_ASSOCIATION_POINTS.

SelectCells() and SelectPoints() are the same thing said more plainly.

◆ SelectRegion()

void vtkScivisSelector::SelectRegion ( int x0,
int y0,
int x1,
int y1,
bool extend = false )

Select the screen-space region bounded by the two corner points, exactly as an interactive rubber-band drag would.

The corners are given in display coordinates and may be in any order; the region is normalized and clamped to the renderer, and a degenerate region – a click – is expanded slightly so that it still picks.

The selection honors the current mode and field association, is applied to every representation in the view, becomes the current selection, and fires SelectionChangedEvent. When extend is true it adds to the existing selection rather than replacing it.

This is what the view's rubber band drives, and the supported way for application code or an interactor style of your own to select without synthesizing interactor events.

◆ Clear()

void vtkScivisSelector::Clear ( )

Drop the current selection, on every representation in the view.

◆ GetCurrentSelection()

virtual vtkSelection * vtkScivisSelector::GetCurrentSelection ( )
virtual

What the last selection picked, or null if nothing has been selected.

SelectionChangedEvent is fired on this object when the selection changes, with the vtkSelection as call data. Observe the selector rather than the view: selection is what this object is for, and firing the same event in two places would leave an observer to work out which one to trust.

◆ SetView()

void vtkScivisSelector::SetView ( vtkScivisView * view)

The view this selects in.

Set by the view that owns this object; there is no reason for anything else to call it.

Held weakly, so a selector kept alive after its view has gone reports no selection rather than following a dangling pointer.

◆ GetView()

vtkScivisView * vtkScivisSelector::GetView ( )

The view this selects in.

Set by the view that owns this object; there is no reason for anything else to call it.

Held weakly, so a selector kept alive after its view has gone reports no selection rather than following a dangling pointer.


The documentation for this class was generated from the following file: