GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  SOSELECTION (3)

NAME

SoSelection — manages a list of selected objects

CONTENTS

Inherits From
Synopsis
Description
Fields
Methods
File Format/defaults
See Also

INHERITS FROM

SoBase > SoFieldContainer > SoNode > SoGroup > SoSeparator > SoSelection

SYNOPSIS

#include <Inventor/nodes/SoSelection.h>

    typedef void    
                    
typedef void         SoSelectionPathCB(void *userData, SoPath *path)    
typedef void    
                    
typedef void         SoSelectionClassCB(void *userData, SoSelection *sel)    
typedef SoPath *    
                    
typedef SoPath *     SoSelectionPickCB(void *userData, const SoPickedPoint *pick)

enum Policy {     SoSelection::SINGLE    
                      SoSelection::SINGLE   Left mouse pick on object clears selection, then selects object. Left mouse pick on nothing clears selection. Only one object may be selected at a time.    
SoSelection::TOGGLE    
                      SoSelection::TOGGLE   Left mouse pick on object toggles its selection status. Left mouse pick on nothing does nothing. Multiple objects may be selected.    
SoSelection::SHIFT    
                      SoSelection::SHIFT    When shift key is down, selection policy is TOGGLE. When shift key is up, selection policy is SINGLE. Multiple objects may be selected.
}

Fields from class SoSelection:

    SoSFEnum    
                    
SoSFEnum             policy

Fields from class SoSeparator:

    SoSFEnum    
                    
SoSFEnum             renderCaching    
SoSFEnum    
                    
SoSFEnum             boundingBoxCaching    
SoSFEnum    
                    
SoSFEnum             renderCulling    
SoSFEnum    
                    
SoSFEnum             pickCulling

Methods from class SoSelection:

       
                    
                     SoSelection()    
   
                    
                     SoSelection(int nChildren)    
static SoType    
                    
static SoType        getClassTypeId()    
void    
                    
void                 select(const SoPath *path)    
void    
                    
void                 select(SoNode *node)    
void    
                    
void                 deselect(const SoPath *path)    
void    
                    
void                 deselect(int which)    
void    
                    
void                 deselect(SoNode *node)    
void    
                    
void                 toggle(const SoPath *path)    
void    
                    
void                 toggle(SoNode *node)    
SbBool    
                    
SbBool               isSelected(const SoPath *path) const    
SbBool    
                    
SbBool               isSelected(SoNode *node) const    
void    
                    
void                 deselectAll()    
int    
                    
int                  getNumSelected() const    
const SoPathList *    
                    
const SoPathList *   getList() const    
SoPath *    
                    
SoPath *             getPath(int index) const    
SoPath *    
                    
SoPath *             operator [](int i) const    
void    
                    
void                 addSelectionCallback(SoSelectionPathCB *f, void *userData = NULL)    
void    
                    
void                 removeSelectionCallback(SoSelectionPathCB *f, void *userData = NULL)    
void    
                    
void                 addDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL)    
void    
                    
void                 removeDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL)    
void    
                    
void                 addStartCallback(SoSelectionClassCB *f, void *userData = NULL)    
void    
                    
void                 removeStartCallback(SoSelectionClassCB *f, void *userData = NULL)    
void    
                    
void                 addFinishCallback(SoSelectionClassCB *f, void *userData = NULL)    
void    
                    
void                 removeFinishCallback(SoSelectionClassCB *f, void *userData = NULL)    
void    
                    
void                 setPickFilterCallback(SoSelectionPickCB *f, void *userData = NULL, SbBool callOnlyIfSelectable = TRUE)    
void    
                    
void                 setPickMatching(SbBool pickTwice)    
SbBool    
                    
SbBool               getPickMatching() const

Methods from class SoSeparator:

    static void    
                    
static void          setNumRenderCaches(int howMany)    
static int    
                    
static int           getNumRenderCaches()

Methods from class SoGroup:

    void    
                    
void                 addChild(SoNode *child)    
void    
                    
void                 insertChild(SoNode *child, int newChildIndex)    
SoNode *    
                    
SoNode *             getChild(int index) const    
int    
                    
int                  findChild(const SoNode *child) const    
int    
                    
int                  getNumChildren() const    
void    
                    
void                 removeChild(int index)    
void    
                    
void                 removeChild(SoNode *child)    
void    
                    
void                 removeAllChildren()    
void    
                    
void                 replaceChild(int index, SoNode *newChild)    
void    
                    
void                 replaceChild(SoNode *oldChild, SoNode *newChild)

Methods from class SoNode:

    void    
                    
void                 setOverride(SbBool state)    
SbBool    
                    
SbBool               isOverride() const    
SoNode *    
                    
SoNode *             copy(SbBool copyConnections = FALSE) const    
virtual SbBool    
                    
virtual SbBool       affectsState() const    
static SoNode *    
                    
static SoNode *      getByName(const SbName &name)    
static int    
                    
static int           getByName(const SbName &name, SoNodeList &list)

Methods from class SoFieldContainer:

    void    
                    
void                 setToDefaults()    
SbBool    
                    
SbBool               hasDefaultValues() const    
SbBool    
                    
SbBool               fieldsAreEqual(const SoFieldContainer *fc) const    
void    
                    
void                 copyFieldValues(const SoFieldContainer *fc, SbBool copyConnections = FALSE)    
SbBool    
                    
SbBool               set(const char *fieldDataString)    
void    
                    
void                 get(SbString &fieldDataString)    
virtual int    
                    
virtual int          getFields(SoFieldList &resultList) const    
virtual SoField *    
                    
virtual SoField *    getField(const SbName &fieldName) const    
SbBool    
                    
SbBool               getFieldName(const SoField *field, SbName &fieldName) const    
SbBool    
                    
SbBool               isNotifyEnabled() const    
SbBool    
                    
SbBool               enableNotify(SbBool flag)

Methods from class SoBase:

    void    
                    
void                 ref()    
void    
                    
void                 unref() const    
void    
                    
void                 unrefNoDelete() const    
void    
                    
void                 touch()    
virtual SoType    
                    
virtual SoType       getTypeId() const    
SbBool    
                    
SbBool               isOfType(SoType type) const    
virtual void    
                    
virtual void         setName(const SbName &name)    
virtual SbName    
                    
virtual SbName       getName() const

DESCRIPTION

SoSelection defines a node which can be inserted into a scene graph and will generate and manage a selection list from picks on any node in the subgraph below it. Nodes are selected based on a current selection policy. Callback functions report back to the application when a path has been selected or deselected. The selection list can also be managed programmatically.

When handling events, SoSelection makes sure that the mouse release event was over the same object as the mouse press event before changing the list of selected objects. This allows users to mouse down on an object, change their mind and move the cursor off the object, then release the mouse button without altering the selection.

The selection can be highlighted automatically through the SoXtRenderArea, or the application can provide custom highlights. Please see the chapter "Creating a Selection Highlight Style" in the Inventor Toolmaker.

FIELDS

    SoSFEnum    
                    
SoSFEnum             policy
Selection policy that is followed in response to user interaction. This can be set to SoSelection::SINGLE, SoSelection::TOGGLE, or SoSelection::SHIFT.

METHODS

       
                    
                     SoSelection()
Creates a selection node with the default settings.

       
                    
                     SoSelection(int nChildren)
Constructor that specifies the approximate number of children.

    static SoType    
                    
static SoType        getClassTypeId()
Return the type id for the SoSelection class.

    void    
                    
void                 select(const SoPath *path)
Select the passed path by adding it to the selection list. The selection node must lie in the path. The path is copied and truncated such that the selection node is the head of the path. If the selection node does not lie in the path, the selection list remains unchanged. This method ignores the current selection policy.

    void    
                    
void                 select(SoNode *node)
Select the passed node by creating a path to it, and adding the path to the selection list by calling select(path). If there is more than one instance of node beneath the selection node, the created path will be the first instance found.

    void    
                    
void                 deselect(const SoPath *path)
Deselect the passed path by removing it from the selection list.

    void    
                    
void                 deselect(int which)
Deselect a path by removing it from the selection list. The argument which specifies which path in the list to be removed.

    void    
                    
void                 deselect(SoNode *node)
Deselect the passed node by creating a path to it, and removing the node from the selection list by calling deselect(path). If there is more than one instance of node beneath the selection node, the created path will be the first instance found.

    void    
                    
void                 toggle(const SoPath *path)
Toggle the selection status of the passed path — if the path is in the selection list, it is removed; if not in the list, it is added.

    void    
                    
void                 toggle(SoNode *node)
Toggle the selection status of the passed node by creating a path to it, then calling toggle(path). If there is more than one instance of node beneath the selection node, the created path will be the first instance found.

    SbBool    
                    
SbBool               isSelected(const SoPath *path) const
Returns TRUE if the passed path is selected, that is, if it is in the selection list.

    SbBool    
                    
SbBool               isSelected(SoNode *node) const
Returns TRUE if the passed node is selected by creating a path to it, then calling isSelected(). If there is more than one instance of node beneath the selection node, the created path will be the first instance found.

    void    
                    
void                 deselectAll()
Deselect all paths in the selection list, that is, clear the list.

    int    
                    
int                  getNumSelected() const
Return the number of paths in the selection list.

    const SoPathList *    
                    
const SoPathList *   getList() const
Return the list of selected paths.

    SoPath *    
                    
SoPath *             getPath(int index) const    
SoPath *    
                    
SoPath *             operator [](int i) const
Return the ith path in the selection list.

    void    
                    
void                 addSelectionCallback(SoSelectionPathCB *f, void *userData = NULL)    
void    
                    
void                 removeSelectionCallback(SoSelectionPathCB *f, void *userData = NULL)
The selection callbacks are invoked every time an object is selected, whether it be from user interaction or from method call. The callbacks are invoked after the object has been added to the selection list.

    void    
                    
void                 addDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL)    
void    
                    
void                 removeDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL)
The deselection callbacks are invoked every time an object is deselected, whether it be from user interaction or from method call. This is invoked after the object has been removed from the selection list.

    void    
                    
void                 addStartCallback(SoSelectionClassCB *f, void *userData = NULL)    
void    
                    
void                 removeStartCallback(SoSelectionClassCB *f, void *userData = NULL)
The start callbacks are invoked when the user has initiated an interactive change to the selection list (by picking objects). This will be followed by invocations of the select and/or deselect callbacks, finally followed by each finish callback. A start callback can be used, for instance, to save the current selection for later restoration (e.g. undo/redo). The start callbacks are not called when the selection list is changed programmatically.

    void    
                    
void                 addFinishCallback(SoSelectionClassCB *f, void *userData = NULL)    
void    
                    
void                 removeFinishCallback(SoSelectionClassCB *f, void *userData = NULL)
The finish callbacks are invoked when the user has finished interactively changing the selection list (by picking objects). This was preceded by an invocation of each start callback, and invocations of the select and/or deselect callbacks. The finish callbacks are not called when the selection list is changed programmatically.

    void    
                    
void                 setPickFilterCallback(SoSelectionPickCB *f, void *userData = NULL, SbBool callOnlyIfSelectable = TRUE)
The pick filter callback is invoked when a pick has occurred and the selection node is about to change the selection list. The callback function returns the path that the selection node should use when selecting and deselecting. If no pick callback is registered (the default), the selection node will use the path returned by SoPickedPoint::getPath() on the picked point associated with the event being processed. The returned path should not be ref’d - selection will ref() and unref() it. (See SoPath::unrefNoDelete().)

Note that a picked object may or may not be a child of the selection node. A selection node will only select paths that pass through it. Possible return values from the callback:

[a] NULL — selection behaves as if nothing was picked (i.e. for SINGLE and SHIFT policies, this clears the selection list). Handle event action traversal halts.

[b] Path — this path will be selected/deselected according to the selection policy (it must lie under the selection node). Handle event action traversal halts.

[c] Path containing only the selection node — apply the selection policy as if nothing was picked. Handle event action traversal continues.

[d] Path not passing through the selection node — selection ignores this pick event and no change is made to the selection list. Handle event action traversal continues.

A simple way to tell selection to ignore the pick is to return an SoPath with no nodes in it. (i.e. return new SoPath;) Selection will always ref the path returned by the callback, make a copy of the path, then unref the path.

The callOnlyIfSelectable argument, when set to TRUE, means the pick callback function will only be invoked on picks which pass through the selection node. When FALSE, all picks will be passed to the callback whether they pass through the selection or not.

    void    
                    
void                 setPickMatching(SbBool pickTwice)    
SbBool    
                    
SbBool               getPickMatching() const
SoSelection will pick once on mouse down and once on mouse up, and make sure the picks match before changing the selection list. This allows the user to pick down on an object, change their mind and drag off the object, release the mouse button and not affect the selection. Pass TRUE to enable this behavior. Pass FALSE to disable this, meaning whatever is picked on a mouse release is added to/removed from the selection list. Default is pick-matching on.

FILE FORMAT/DEFAULTS

Selection {



renderCaching       AUTO
boundingBoxCaching  AUTO
renderCulling       AUTO
pickCulling         AUTO
policy              SHIFT


}

SEE ALSO

SoEventCallback, SoXtRenderArea, SoBoxHighlightRenderAction, SoLineHighlightRenderAction

Search for    or go to Top of page |  Section 3 |  Main Index


SOSELECTION(3IV) (-->)

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.