SoSelection Class |
Manages a list of selected objects.
Namespace: OIV.Inventor.Nodes
The SoSelection type exposes the following members.
Name | Description | |
---|---|---|
SoSelection | Creates a selection node with the default settings. | |
SoSelection(Int32) | Constructor that specifies the approximate number of children. |
Name | Description | |
---|---|---|
AddChild | Adds a child as last one in group. | |
AffectsState | Returns true if a node has an effect on the state during traversal. | |
Callback | (Inherited from SoSeparator.) | |
ClearCacheList | (Inherited from SoSeparator.) | |
Copy | Calls Copy(false). (Inherited from SoNode.) | |
Copy(Boolean) | Creates and returns an exact copy of the node. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Deselect(Int32) | Deselects a path by removing it from the selection list. | |
Deselect(SoNode) | Deselects the passed node by creating a path to it, and removing the node from the selection list by calling deselect(path) . | |
Deselect(SoPath) | Deselects the passed path by removing it from the selection list. | |
DeselectAll | Deselects all paths in the selection list, that is, clear the list. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Distribute | (Inherited from SoNode.) | |
DoAction | (Inherited from SoSeparator.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
FindChild | Finds index of given child within group. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetAlternateRep | This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type). | |
GetBoundingBox | (Inherited from SoSeparator.) | |
GetChild | Returns pointer the child node with the given index. | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetList | Returns the list of selected paths. | |
GetMatrix | (Inherited from SoSeparator.) | |
GetName | Returns the name of an instance. | |
GetNumChildren | Returns number of children. | |
GetNumSelected | Returns the number of paths in the selection list. | |
GetPath | Returns the ith path in the selection list. | |
GetPickRadius | Returns the radius (in pixels) around the viewport-space point through which the ray passes when doing ray picking. | |
GetPrimitiveCount | (Inherited from SoSeparator.) | |
GetRenderEngineMode | Returns the supported Render engine mode. | |
GetRenderUnitID | (Inherited from SoNode.) | |
GetStringName | (Inherited from SoBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GLRender | (Inherited from SoSeparator.) | |
GLRenderBelowPath | (Inherited from SoSeparator.) | |
GLRenderInPath | (Inherited from SoSeparator.) | |
GLRenderOffPath | (Inherited from SoSeparator.) | |
GrabEventsCleanup | (Inherited from SoNode.) | |
GrabEventsSetup | (Inherited from SoNode.) | |
HandleEvent | (Overrides SoSeparatorHandleEvent(SoHandleEventAction).) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
InsertChild | Adds a child so that it becomes the one with the given index. | |
IsBoundingBoxIgnoring | Used by BoundingBoxAction to known if bounding box computation should be ignored or not. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsOverride | Returns the state of the override flag. | |
IsPickMatching | Returns pick matching flag. | |
IsSelected(SoNode) | Returns true if the passed node is selected by creating a path to it, then calling OIV.Inventor.Nodes.SoSelection.IsSelected(OIV.Inventor.SoPath). | |
IsSelected(SoPath) | Returns true if the passed path is selected, that is, if it is in the selection list. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
Pick | (Inherited from SoGroup.) | |
RayPick | (Inherited from SoSeparator.) | |
RemoveAllChildren | Removes all children from group. | |
RemoveChild(Int32) | Removes child with given index from group. | |
RemoveChild(SoNode) | Removes first instance of given child from group. | |
ReplaceChild(Int32, SoNode) | Replaces child with given index with new child. | |
ReplaceChild(SoNode, SoNode) | Replaces first instance of given child with new child. | |
Search | (Inherited from SoSeparator.) | |
Select(SoNode) | Selects the passed node by creating a path to it, and adding the path to the selection list by calling select(path) . | |
Select(SoPath) | Selects the passed path by adding it to the selection list. | |
Set | Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. | |
SetName | (Inherited from SoBase.) | |
SetOverride | Turns the override flag on or off. | |
SetPickFilterCallback(SoSelectionPickCB) | Calls SetPickFilterCallback(f, true). | |
SetPickFilterCallback(SoSelectionPickCB, Boolean) | The pick filter callback is invoked when a pick has occurred and the selection node is about to change the selection list. | |
SetPickMatching | OIV.Inventor.Nodes.SoSelection will pick once on mouse down and once on mouse up, and make sure the picks match before changing the selection list. | |
SetPickRadius | Sets the radius (in pixels) around the viewport-space point through which the ray passes when doing ray picking. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
Toggle(SoNode) | Toggles the selection status of the passed node by creating a path to it, then calling toggle(path) . | |
Toggle(SoPath) | Toggles 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. | |
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. | |
Write | (Inherited from SoGroup.) |
Name | Description | |
---|---|---|
boundingBoxCaching | (Inherited from SoSeparator.) | |
boundingBoxIgnoring | Whether to ignore this node during bounding box traversal. | |
fastEditing | Specifies the fast edit mode of the separator node. | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
Item | Returns the ith path in the selection list. | |
pickCulling | Whether to cull during picking traversal. | |
policy | Selection policy that is followed in response to user interaction. | |
renderCaching | Obsolete. Whether to cache during rendering traversal. | |
renderCulling | Whether to cull during rendering traversal. | |
renderUnitId | Used during the ScaleViz depth compositing process, this field specifies which render unit (OIRU) will render the sub scene graph below this separator. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) |
Name | Description | |
---|---|---|
Deselection | ||
FinishSelection | ||
Selection | ||
StartSelection |
OIV.Inventor.Nodes.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. Delegate functions report back to the application when a path has been selected or deselected. The selection list can also be managed programmatically.
OIV.Inventor.Nodes.SoSelection is convenient when the application just needs to know the path (OIV.Inventor.SoPath) to the objects that were selected (or deselected). OIV.Inventor.Nodes.SoSelection automatically does picking (applies an OIV.Inventor.Actions.SoRayPickAction), but it does not provide information about the picked point or pick details. For that see OIV.Inventor.Actions.SoRayPickAction, OIV.Inventor.Nodes.SoEventCallback and OIV.Inventor.Details.SoDetail. OIV.Inventor.Nodes.SoSelection does picking based on a single coordinate (the cursor position). The OIV.Inventor.Nodes.SoExtSelection node can do selection based on a lasso or rectangle drawn on the screen.
The selection callbacks are invoked every time an object is selected, whether from user interaction or from a method call. The callbacks are invoked after the object has been added to the selection list.
When handling events, by default OIV.Inventor.Nodes.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. See the OIV.Inventor.Nodes.SoSelection.SetPickMatching(System.Boolean) method.
The selection can be highlighted automatically by replacing the render area's render action with one of the specialized highlighting render actions, for example OIV.Inventor.Actions.SoHaloHighlightRenderAction. See the code example below. The application can also create a custom highlight action. See the chapter "Creating a Selection Highlight Style" in the Inventor Toolmaker Volume 1.
It is possible to use multiple OIV.Inventor.Nodes.SoSelection nodes in a scene graph, but there are a few things to keep in mind:
If two selection nodes could potentially select the same geometry, the geometry will be selected by the selection node lowest in the scene graph (the closest ancestor of the geometry).
The automatic viewer redraw on selection change (renderArea's redrawOnSelectionChange method) feature currently only works for a single selection node. You can work around this by calling renderArea's scheduleRedraw() method in a selection delegate.
The box and line highlighting render actions currently search for the first selection node in the scene graph and only highlight geometry selected by that selection node. You can work around this by creating a custom highlight action.
Instancing: When instance nodes of a OIV.Inventor.Nodes.SoMultipleInstance or a OIV.Inventor.Nodes.SoMultipleCopy group are selected, the application can get the instance identifier using the OIV.Inventor.SoPath method getInstanceIndex().
Hidden references:
OIV.Inventor.Nodes.SoSelection creates an OIV.Inventor.SoPath when an object is added to the selection list. The OIV.Inventor.SoPath references each node in the path, including the OIV.Inventor.Nodes.SoSelection node. This reference will prevent those nodes, including the OIV.Inventor.Nodes.SoSelection, from being reclaimed for as long as the OIV.Inventor.SoPath exists. The OIV.Inventor.SoPath exists until the object is deselected or the selection list is cleared. In general, the OIV.Inventor.Nodes.SoSelection.DeselectAll() method should be called when the OIV.Inventor.Nodes.SoSelection is no longer needed.
Create an OIV.Inventor.Nodes.SoSelection node, set a selection callback and add children.
SoSelection selectionNode = new SoSelection();
selectionNode.Selection += selectionCB;
selectionNode.Deselection += deselectionCB;
selectionNode.AddChild(scene);
Enable automatic highlighting.
viewer.SetSceneGraph( selectionNode );
viewer.RedrawOnSelectionChange( selectionNode );
viewer.SetGLRenderAction( new SoHaloHighlightRenderAction() );
Implement the selection and deselection callbacks.
public void selectionCB(SoPath path) { SoNode node = path.GetTail(); Console.WriteLine("Selected {0}", node.GetType().Name); } public void deselectionCB(SoPath path) { SoNode node = path.GetTail(); Console.WriteLine("De-selected {0}", node.GetType().Name); }
Selection {
boundingBoxCaching | AUTO |
renderCulling | AUTO |
pickCulling | AUTO |
policy | SHIFT |
fastEditing | DISABLE |