![]() |
http://www.sim.no http://www.coin3d.org |
The SoSelection class manages a list of selected nodes. More...
#include <Inventor/nodes/SoSelection.h>
Public Types | |
enum | Policy { SINGLE , TOGGLE , SHIFT } |
![]() | |
enum | CacheEnabled { OFF , ON , AUTO } |
![]() | |
enum | NodeType { INVENTOR = 0x0000 , VRML1 = 0x0001 , VRML2 = 0x0002 , INVENTOR_1 = 0x0004 , INVENTOR_2_0 = 0x0008 , INVENTOR_2_1 = 0x0010 , INVENTOR_2_5 = 0x0020 , INVENTOR_2_6 = 0x0040 , COIN_1_0 = 0x0080 , COIN_2_0 = 0x0100 , EXTENSION = 0x0200 , COIN_2_2 = 0x0400 , COIN_2_3 = 0x0800 , COIN_2_4 = 0x1000 , INVENTOR_5_0 = 0x2000 , COIN_2_5 = 0x4000 } |
Public Attributes | |
SoSFEnum | policy |
![]() | |
SoSFEnum | renderCaching |
SoSFEnum | boundingBoxCaching |
SoSFEnum | renderCulling |
SoSFEnum | pickCulling |
Static Protected Member Functions | |
static const SoFieldData ** | getFieldDataPtr (void) |
![]() | |
static const SoFieldData ** | getFieldDataPtr (void) |
![]() | |
static const SoFieldData ** | getFieldDataPtr (void) |
![]() | |
static const SoFieldData ** | getFieldDataPtr (void) |
static void | setNextActionMethodIndex (int index) |
static int | getNextActionMethodIndex (void) |
static void | incNextActionMethodIndex (void) |
static void | setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask) |
![]() | |
static uint32_t | getCurrentWriteCounter (void) |
static void | staticDataLock (void) |
static void | staticDataUnlock (void) |
Protected Attributes | |
SoPathList | selectionList |
SoCallbackList * | selCBList |
SoCallbackList * | deselCBList |
SoCallbackList * | startCBList |
SoCallbackList * | finishCBList |
SoSelectionPickCB * | pickCBFunc |
void * | pickCBData |
SbBool | callPickCBOnlyIfSelectable |
SoCallbackList * | changeCBList |
SoPath * | mouseDownPickPath |
SbBool | pickMatching |
![]() | |
SoChildList * | children |
![]() | |
uint32_t | uniqueId |
![]() | |
SbBool | isBuiltIn |
Additional Inherited Members | |
![]() | |
enum | BaseFlags { IS_ENGINE = 0x01 , IS_GROUP = 0x02 } |
![]() | |
static uint32_t | nextUniqueId = 0 |
static int | nextActionMethodIndex = 0 |
The SoSelection class manages a list of selected nodes.
Inserting an SoSelection node in your scene graph enables you to let the user "pick" with the left mousebutton to select/deselect objects below the SoSelection node.
Using an SoBoxHighlightRenderAction or an SoLineHighlightRenderAction to render scenegraphs containing SoSelection nodes provides a convenient way of providing visual feedback about the selections to the application user.
Beware that one common faulty assumption which is made about the node is that the scene will automatically be re-rendered whenever the user pick objects. This is not the case, the application programmer must himself schedule a redraw. A straightforward way to accomplish this is to SoNode::touch() the SoSelection node in the selection / deselection callback.
A "skeleton" for basic use of SoSelection nodes is given below:
This node is not initialized in SoDB::init(), since it is part of the interaction kit "add-on". Before using this node, you should therefore call SoInteraction::init(). If you're using one of the standard GUI-toolkits (SoXt / SoQt / SoWin) SoInteraction::init() will be called for you from the So[Xt|Qt|Win]init() method and you don't have to worry about it.
With regard to using multiple SoSelection nodes at the same time in the same scene graph: this is possible, but it is not straightforward. The standard viewers provided by SoQt, SoWin, et al, will only snoop on one SoSelection node (part of the the legacy API from SGI's InventorXt), so selection changes on the others doesn't trigger redraws. You don't necessarily see what's happening in other words. You'll have to hook up manually and trigger redraws yourself.
Also be aware that when having multiple SoSelection nodes in the scene graph active at the same time, the SoHandleEventAction traversals that you intend for selection-change on one SoSelection node will also affect all the other SoSelection nodes in the scene – usually delesecting everything below them since you will be clicking outside the selectable objects. You'll therefore also have to manually override that behaviour, if you want selection change on one SoSelection node to not affect the others.
FILE FORMAT/DEFAULTS:
Enum for different pick policies.
SoSelection::SoSelection | ( | void | ) |
Default constructor.
SoSelection::SoSelection | ( | const int | nChildren | ) |
Constructor.
The argument should be the approximate number of children which is expected to be inserted below this node. The number need not be exact, as it is only used as a hint for better memory resource allocation.
|
protectedvirtual |
Destructor.
References changeCBList, deselCBList, finishCBList, mouseDownPickPath, selCBList, startCBList, and SoBase::unref().
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting.
Usage example:
For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.
For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.
Reimplemented from SoSeparator.
Reimplemented in SoExtSelection.
|
protectedvirtual |
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL
.
Reimplemented from SoSeparator.
Reimplemented in SoExtSelection.
Adds path to the list of selected objects.
References addPath(), copyFromThis(), and findPath().
Referenced by performSingleSelection(), performToggleSelection(), and toggle().
Adds node to the list of selected objects. The scene graph below the Selection node will be searched, and the path to node will be added if found.
References addPath(), findPath(), and SoBase::unref().
Remove path from the list of selected objects.
References findPath(), and removePath().
Referenced by deselect().
Remove objects which from the list of selected objects.
References removePath().
Remove node from the list of selected objects. The scene graph below the Selection node will be searched, and the path to node will be removed if found.
References deselect(), and SoBase::unref().
If path is not already selected, add path to the list of selected objects. Otherwise remove path from the list of selected objects.
References findPath(), removePath(), and select().
Referenced by invokeSelectionPolicy(), and toggle().
If node is not already selected, add path to the list of selected objects. Otherwise remove node from the list of selected objects.
References toggle(), and SoBase::unref().
Return TRUE if path is in the list of selected objects.
References findPath().
Referenced by isSelected().
SbBool SoSelection::isSelected | ( | SoNode * | node | ) | const |
Return TRUE if the path to node is in the list of selected objects.
References isSelected(), and SoBase::unref().
Clears the selection list.
References getNumSelected(), and removePath().
int SoSelection::getNumSelected | ( | void | ) | const |
Returns the number of selected objects.
References SbPList::getLength(), and selectionList.
Referenced by deselectAll(), and performSingleSelection().
const SoPathList * SoSelection::getList | ( | void | ) | const |
Returns the list of selected objects.
References selectionList.
Returns the index'th selected objects.
References selectionList.
Referenced by performSingleSelection().
Operator for accessing selected objects.
References selectionList.
Adds a callback which will be called every time an object is selected.
References SoCallbackList::addCallback(), and selCBList.
Removes one of the selection callbacks.
References SoCallbackList::removeCallback(), and selCBList.
Adds a callback which will be called every time an object is deselected.
References SoCallbackList::addCallback(), and deselCBList.
Removes one of the deselection callbacks.
References deselCBList, and SoCallbackList::removeCallback().
Adds a callback which will be invoked when the user start an interactive change to the list of selected objects.
This callback is useful for storing the old selection list for undo/redo functionality.
References SoCallbackList::addCallback(), and startCBList.
Removes f from the list of start callbacks.
References SoCallbackList::removeCallback(), and startCBList.
Adds a callback which will be invoked when the user has finished an interactive change to the list of selected objects.
References SoCallbackList::addCallback(), and finishCBList.
Removes f from the list og finish callbacks.
References finishCBList, and SoCallbackList::removeCallback().
void SoSelection::setPickFilterCallback | ( | SoSelectionPickCB * | f, |
void * | userData = NULL , |
||
const SbBool | callOnlyIfSelectable = 1 |
||
) |
Sets the pick filter callback. This callback will be called when a path is about to be added to or removed from the list of selected objects. The callback function should return a replacement path that should be used instead of the picked path. The returned path will be ref'ed, copied, and then unref'ed again by the SoSelection node.
If no callback is set (the default), the picked path will be used for selecting/deselecting.
Possible return values from the callback:
if callOnlyIfSelectable is TRUE
, the callback will only be called if the Selection node is in the picked path.
References callPickCBOnlyIfSelectable, pickCBData, and pickCBFunc.
When pickmatchflag is TRUE
(the default), the mouse button release pick must match the mouse button press pick before object is selected/deselected.
This flag should normally not be of interest to application programmers.
References pickMatching.
SbBool SoSelection::isPickMatching | ( | void | ) | const |
SbBool SoSelection::getPickMatching | ( | void | ) | const |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
. Used by render area to receive notification when the selection list changes.
References SoCallbackList::addCallback(), and changeCBList.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Used by render area to receive notification when the selection list changes.
References changeCBList, and SoCallbackList::removeCallback().
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References performSingleSelection(), performToggleSelection(), policy, SHIFT, TOGGLE, and toggle().
Referenced by handleEvent().
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References copyFromThis(), getNumSelected(), getPath(), removePath(), and select().
Referenced by invokeSelectionPolicy().
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References SoPath::findNode(), findPath(), removePath(), and select().
Referenced by invokeSelectionPolicy().
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References SoPath::copy(), SoPath::findNode(), SoBase::ref(), and SoBase::unrefNoDelete().
Referenced by findPath(), performSingleSelection(), and select().
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References SoPathList::append(), changeCBList, SoCallbackList::invokeCallbacks(), selCBList, and selectionList.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References changeCBList, deselCBList, SoCallbackList::invokeCallbacks(), SoBase::ref(), SoBaseList::remove(), selectionList, and SoBase::unref().
Referenced by deselect(), deselect(), deselectAll(), performSingleSelection(), performToggleSelection(), and toggle().
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
References copyFromThis(), SoPathList::findPath(), SoPath::getHead(), and selectionList.
Referenced by deselect(), isSelected(), performToggleSelection(), select(), select(), and toggle().
|
protectedvirtual |
Action method for SoHandleEventAction.
Inspects the event data from action, and processes it if it is something which this node should react to.
Nodes influencing relevant state variables for how event handling is done also overrides this method.
Reimplemented from SoSeparator.
Reimplemented in SoExtSelection.
References callPickCBOnlyIfSelectable, SoPath::findNode(), finishCBList, SoHandleEventAction::getEvent(), SoHandleEventAction::getPickedPoint(), SoSeparator::handleEvent(), SoCallbackList::invokeCallbacks(), invokeSelectionPolicy(), SoHandleEventAction::isHandled(), mouseDownPickPath, pickCBData, pickCBFunc, SoBase::ref(), SoHandleEventAction::setHandled(), startCBList, and SoBase::unref().
Referenced by SoExtSelection::handleEvent().
SoSFEnum SoSelection::policy |
Field for selection policy. Default value is SHIFT.
Referenced by invokeSelectionPolicy().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by addPath(), findPath(), getList(), getNumSelected(), getPath(), operator[](), and removePath().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by addPath(), addSelectionCallback(), removeSelectionCallback(), and ~SoSelection().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by addDeselectionCallback(), removeDeselectionCallback(), removePath(), and ~SoSelection().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by addStartCallback(), handleEvent(), removeStartCallback(), and ~SoSelection().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by addFinishCallback(), handleEvent(), removeFinishCallback(), and ~SoSelection().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by handleEvent(), and setPickFilterCallback().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by handleEvent(), and setPickFilterCallback().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by handleEvent(), and setPickFilterCallback().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by addChangeCallback(), addPath(), removeChangeCallback(), removePath(), and ~SoSelection().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by handleEvent(), and ~SoSelection().
|
protected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Referenced by getPickMatching(), isPickMatching(), and setPickMatching().
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Wed Jul 19 2023 for Coin by Doxygen. 1.9.8