SoExtSelection Class Reference
[Groups]

VSG extension Selection node that supports lasso selection. More...

#include <Inventor/nodes/SoExtSelection.h>

Inheritance diagram for SoExtSelection:
SoSelection SoSeparator SoGroup SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Classes

struct  PreFilterEventArg
 Structure given to callback when a PreFilter event is raised. More...

Public Types

enum  LassoType {
  NOLASSO,
  LASSO,
  RECTANGLE,
  ELLIPSE
}
enum  LassoPolicy {
  FULL_BBOX,
  PART_BBOX,
  FULL,
  PART
}
enum  LassoMode {
  VISIBLE_SHAPES,
  ALL_SHAPES
}
enum  ReturnType {
  NOSELECT_CONTINUE,
  SELECT_RETURN,
  SELECT_CONTINUE,
  NOSELECT_RETURN
}
typedef SbBool SoExtSelectionTriangleCB (void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)
typedef SbBool SoExtSelectionLineSegmentCB (void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2)
typedef SbBool SoExtSelectionPointCB (void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1)
typedef SbBool SelectionEventCallback (const SbVec2s &position, const SbVec3f &scenePosition, SoExtSelection *selection, void *userData)

Public Member Functions

virtual SoType getTypeId () const
 SoExtSelection ()
void useFastEditing (SbBool flg=TRUE)
SbBool isUsingFastEditing ()
SoSeparatorgetOverlaySceneGraph ()
void setOverlayLassoColorIndex (int index)
int getOverlayLassoColorIndex ()
void setLassoColor (SbColor c)
SbColor getLassoColor ()
void setLassoWidth (float width)
float getLassoWidth ()
void setOverlayLassoPattern (unsigned short pattern)
unsigned short getOverlayLassoPattern ()
void animateOverlayLasso (SbBool flg=TRUE)
SbBool isOverlayLassoAnimated ()
void select (SoNode *root, int numCoord, SbVec2f *lassoCoord, const SbViewportRegion &viewport, SbBool shiftPressed)
virtual void addChild (SoNode *child)
virtual void setSelectionSceneGraph (SoNode *sceneGraph)
virtual SoNodegetSelectionSceneGraph () const
virtual void setStartSelectionCallback (SelectionEventCallback *callback, void *userData=NULL)
virtual void setEndSelectionCallback (SelectionEventCallback *callback, void *userData=NULL)
virtual void setMovingSelectionCallback (SelectionEventCallback *callback, void *userData=NULL)
void setTriangleFilterCallback (SoExtSelectionTriangleCB *cb, void *userData=NULL)
void setLineSegmentFilterCallback (SoExtSelectionLineSegmentCB *cb, void *userData=NULL)
void setPointFilterCallback (SoExtSelectionPointCB *cb, void *userData=NULL)
const SbVec2sgetLassoCoordsDC (int &numCoords)
const SbVec3fgetLassoCoordsWC (int &numCoords)
const SoPathListgetSelectionPathList () const

Static Public Member Functions

static SoType getClassTypeId ()

Public Attributes

SoSFEnum lassoType
SoSFEnum lassoPolicy
SoSFEnum lassoMode
SbEventHandler
< PreFilterEventArg & > 
onPreFilter

Friends

class SimplexSelectorHelper

Deprecated



SoDEPRECATED void useOverlay (SbBool flg=TRUE)
SoDEPRECATED SbBool isUsingOverlay ()
SoDEPRECATED void select (SoNode *root, int numCoord, SbVec3f *lassoCoord, const SbViewportRegion &viewport, SbBool shiftPressed)

Detailed Description

VSG extension Selection node that supports lasso selection.

This class extends the functionality of SoSelection to allow the user to select an object or multiple objects by drawing a lasso around the object(s) to be selected. The lasso can be represented as a rectangle between the mouse up and down positions or as a set of lines that the user draws around the objects, depending on the field lassoType. When lassoType is NOLASSO, or when the lasso is empty (the screen coordinates of the button down and button up event are the same), SoExtSelection behaves exactly like its parent class SoSelection.

Objects are selected if they are surrounded by the lasso or if the lasso intersects them, depending on the field lassoPolicy, as follows:

FULL and PART require more computation and are generally slower.

A lasso mode controls whether only visible shapes (front shapes) are selectable, by controlling the selection algorithm used, either geometry-based or pixel-based. A specific lasso mode may also be preferred for performance reasons depending on the scene.

Primitive details for selected parts of shapes can be obtained through dedicated callbacks that can be also used to filter the selection. These primitive filter callbacks can be called for each generated primitive.

When using SoExtSelection node, the callback set by setPickFilterCallback will be called only once per selected shape. Only SoPickedPoint::getPath() makes sense for the picked point passed to the pick filter callback in this case. Other SoPickedPoint methods may return undefined results.

Lasso selection can be also be controlled programmatically, without requiring user interaction.

NOTE: The features below which depend on overlay planes are supported only if the graphics board supports overlay planes.

NOTE: Using the FastEdit mode:

FastEdit mode provides the advantages of overlay mode without the overlay hardware support requirement. See SoSeparator for more information about the fast editing feature. FastEdit mode can allow the lasso geometry to be redrawn at interactive rates even when the underlying scene takes a long time to redraw. On Windows platforms, it also avoids using GDI to draw the lasso, which conflicts with the "Aero" user interface mode on Windows Vista.

When the application uses fast editing it must call the function useFastEdit(TRUE) first. If it doesn't call this function, operations which require fast edit will output a warning in debug mode.

FastEdit mode also provides some powerful additional features including the option to provide custom (and dynamic) lasso geometry (see the setSelectionSceneGraph() method) and the option to set callbacks on mouse events during selection (see the methods setStartSelectionCallback(), setEndSelectionCallback(), and setMovingSelectionCallback()). The geometry in the selection scene graph can be dynamically updated by the application as the user moves the cursor, using these callbacks. This can useful to display dynamic feedback without actually doing selection. For example to display a "rubber band" line while positioning annotations or measurements. However note that the selection scene graph is always traversed, not just when the user is selecting. It is the application's responsibility to empty the selection scene graph (or hide its contents using an SoSwitch) when appropriate.

Note: The geometry in the selection scene graph is not automatically used for selection. (It may not be appropriate.) However the application can use the select() method, if desired, to do a selection using any set of 2D points defining a "lasso".

Finally note that since Open Inventor 8.6, SoScreenDrawer and its specialized sub-classes provide a more general mechanism for interactively drawing polylines, rectangles, ellipses, etc in screen space.

Clipping:
SoExtSelection avoids selecting shapes that are culled by active SoClipPlane(s) in both the ALL_SHAPES and VISIBLE Lasso modes. The user can disable this, and restore the legacy behavior of SoExtSelection before Open Inventor 9.4.0, by setting the environment variable OIV_SELECTION_USE_CLIPPLANES to 0 (see SoPreferences).

Instancing:
When instance nodes of a SoMultipleInstance or a SoMultipleCopy group are selected, the application can get the instance identifier using the SoPath method getInstanceIndex().

See SoSelection for additional information about the selection list and code example.

FILE FORMAT/DEFAULT

SEE ALSO

SoRayPickAction, SoSelection, SoWinRenderArea

See related examples:

DetailSelection, ExtSelection, FastSelection


Member Typedef Documentation

typedef SbBool SoExtSelection::SelectionEventCallback(const SbVec2s &position, const SbVec3f &scenePosition, SoExtSelection *selection, void *userData)

This is the declaration to use for selection event callback functions.


See setStartSelectionCallback(), setEndSelectionCallback(), and setMovingSelectionCallback(). These callbacks are useful to modify the selection scene graph (see setSelectionSceneGraph) to implement dynamically changing selection feedback.

Note: These callbacks can only be used in FastEdit mode.

Parameters:
position The position of the event in pixel coordinates (0,0 is lower left corner).
scenePosition The position of the event in normalized -1..1 3D coordinates.
selection The selection node that called the function.
userData Optional pointer specified when the callback was set.
Returns:
If the callback handles the event it must return TRUE, else return FALSE.

Member Enumeration Documentation

Lasso mode.

Enumerator:
VISIBLE_SHAPES 

Only visible shapes can be selected.

NOTE: Transparency is not considered. If a semi-transparent shape is in front of another shape, only the front shape will be selected. Even if the shape in back is "visually" visible, it is considered to be hidden by the front shape.

ALL_SHAPES 

All shapes can be selected.

Even if outside of view volume. (default)

Lasso policy.

Enumerator:
FULL_BBOX 

Full bounding box (default).

PART_BBOX 

Partial bounding box.

FULL 

Full.

PART 

Partial.

Lasso type.

Enumerator:
NOLASSO 

No lasso (default).

LASSO 

Lasso.

RECTANGLE 

Rectangle.

ELLIPSE 

Ellipse.

Return type.

Enumerator:
NOSELECT_CONTINUE 

same as FALSE - Do not select the node, but continue with node's next triangle/line/point

SELECT_RETURN 

same as TRUE - Select the node and stop traversing node's triangle/line/point

SELECT_CONTINUE 

Select the node but continue for the remaining triangle/line/point.

NOSELECT_RETURN 

Do not select the node and stop traversing node's triangle/line/point.


Constructor & Destructor Documentation

SoExtSelection::SoExtSelection (  ) 

Constructor.


Member Function Documentation

virtual void SoExtSelection::addChild ( SoNode child  )  [virtual]

Adds a child at the end of the list of children.

It redefines the SoSeparator::addChild function just to ensure that the selection scenegraph is always the last child in the list.

Reimplemented from SoGroup.

void SoExtSelection::animateOverlayLasso ( SbBool  flg = TRUE  ) 

Sets the the lasso animation flag.

This controls whether the lasso is animated (its line pattern changes) or not. Default is FALSE.

static SoType SoExtSelection::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoSelection.

SbColor SoExtSelection::getLassoColor (  )  [inline]

Gets the lasso color.

Applies only if the lasso is not drawn in the overlay plane.

const SbVec2s* SoExtSelection::getLassoCoordsDC ( int &  numCoords  ) 

Returns the lasso coordinates in device coordinates.

const SbVec3f* SoExtSelection::getLassoCoordsWC ( int &  numCoords  ) 

Returns the lasso coordinates in world coordinates.

float SoExtSelection::getLassoWidth (  )  [inline]

Gets the lasso line width.

int SoExtSelection::getOverlayLassoColorIndex (  )  [inline]

Gets the lasso color index.

Applies only if the lasso is drawn in the overlay plane.

unsigned short SoExtSelection::getOverlayLassoPattern (  )  [inline]

Gets the lasso stipple pattern.

Values can range from 0 (invisible) to 0xffff (solid).

SoSeparator* SoExtSelection::getOverlaySceneGraph (  )  [inline]

Returns the scene graph that should be passed to the render area function setOverlaySceneGraph .

Applies only if the lasso is drawn in the overlay plane.

const SoPathList& SoExtSelection::getSelectionPathList (  )  const [inline]

Returns paths list of selected objects.

virtual SoNode* SoExtSelection::getSelectionSceneGraph (  )  const [virtual]

Returns the scenegraph displayed as "lasso" in fast edit mode.

Note: This function is available only in FastEdit mode, returns NULL otherwise.

virtual SoType SoExtSelection::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoSelection.

SbBool SoExtSelection::isOverlayLassoAnimated (  )  [inline]

Gets the the lasso animation flag.

SbBool SoExtSelection::isUsingFastEditing (  )  [inline]

Gets whether the lasso is drawn using fast editing.

SoDEPRECATED SbBool SoExtSelection::isUsingOverlay (  )  [inline]

Gets whether the lasso is drawn in the overlay plane.

Deprecated:

Deprecated since Open Inventor 9610
Overlay feature is legacy, and no longer makes sense with current hardware.
SoDEPRECATED void SoExtSelection::select ( SoNode root,
int  numCoord,
SbVec3f lassoCoord,
const SbViewportRegion viewport,
SbBool  shiftPressed 
)
Deprecated:

Deprecated since Open Inventor 6000
Use the select method with the lasso coordinates given as SbVec2f.
void SoExtSelection::select ( SoNode root,
int  numCoord,
SbVec2f lassoCoord,
const SbViewportRegion viewport,
SbBool  shiftPressed 
)

Simulates interactive selection starting from the root node with the given lasso contour, updating the selection list and triggering any associated callback .

Even though the selection operation may not involve a window per se, some nodes need the viewport information to determine their size and placement.

NOTE: The root node must be the root of a scene graph that includes the camera node. For example, when using an Open Inventor viewer, use getSceneManager()->getSceneGraph().

Setting shiftPressed true simulates the effect of pressing the shift key while selecting, consistent with the SoSelection::Shift policy.

The lasso type can be set using the lassoType field, but the lasso will not be drawn when using this method. The lasso coordinates are given in normalized device coordinates ranging from -1 to +1 in the X and Y directions, determined directly from the viewport.

Note: When the lassoType is set to LASSO the objects are selected according to the points defined by the lasso coordinates so the segments between those points are not part of the lasso!.

virtual void SoExtSelection::setEndSelectionCallback ( SelectionEventCallback callback,
void *  userData = NULL 
) [virtual]

Sets the callback called when the mouse button is released in selection mode.

Note: This function is available only in FastEdit mode.

void SoExtSelection::setLassoColor ( SbColor  c  ) 

Sets the lasso color.

Applies only if the lasso is not drawn in the overlay plane. This function sets the color in FastEdit mode also. Default is red (1,0,0).

void SoExtSelection::setLassoWidth ( float  width  )  [inline]

Sets the lasso line width.

This function sets the width in FastEdit mode also. Default is 1.

void SoExtSelection::setLineSegmentFilterCallback ( SoExtSelectionLineSegmentCB cb,
void *  userData = NULL 
)

Sets the line segment filter callback.

See setTriangleFilterCallback() for details.

virtual void SoExtSelection::setMovingSelectionCallback ( SelectionEventCallback callback,
void *  userData = NULL 
) [virtual]

Sets the callback called when the mouse is moved in selection mode.

The callback is only called while the mouse button is down.

Note: This function is available only in FastEdit mode.

void SoExtSelection::setOverlayLassoColorIndex ( int  index  )  [inline]

Sets the lasso color index.

Applies only if the lasso is drawn in the overlay plane.

void SoExtSelection::setOverlayLassoPattern ( unsigned short  pattern  ) 

Sets the lasso stipple pattern.

Values can range from 0 (invisible) to 0xffff (solid). This specifies how dashed or dotted lasso lines will be drawn. This function actually sets the line pattern in all cases, not just overlay. Default is 0xffff (solid).

void SoExtSelection::setPointFilterCallback ( SoExtSelectionPointCB cb,
void *  userData = NULL 
)

Sets the point filter callback.

See setTriangleFilterCallback() for details.

virtual void SoExtSelection::setSelectionSceneGraph ( SoNode sceneGraph  )  [virtual]

Sets the scenegraph to be displayed as "lasso" in fast edit mode.

Note: This function is available only in FastEdit mode.

The geometry in this scene graph can be dynamically updated by the application as the user moves the cursor. See the methods setStartSelectionCallback(), setMovingSelectionCallback(), etc. This can useful to display dynamic feedback without actually doing selection. For example to display a "rubber band" line while positioning annotation or measurements.

Note: The geometry in this scene graph is not automatically used for selection! (It may not be appropriate.) The application can use the select() method, if desired, to do a selection using any set of 2D points defining a "lasso".

virtual void SoExtSelection::setStartSelectionCallback ( SelectionEventCallback callback,
void *  userData = NULL 
) [virtual]

Sets the callback called when the mouse button is clicked in selection mode.

Note: This function is available only in FastEdit mode.

void SoExtSelection::setTriangleFilterCallback ( SoExtSelectionTriangleCB cb,
void *  userData = NULL 
)

Sets the triangle filter callback .

The primitive filter callbacks can be used to retrieve information about the selected primitives of traversed shape nodes - points, line segments, or triangles - and to filter the shape selection based on the selected primitives. These callbacks are called while traversing the scene graph shapes with an SoCallbackAction started by the SoExtSelection node. Whenever a shape primitive is surrounded by the lasso, the callback is called and receives as argument the action and the primitive. Depending on the shape type, the point, line or triangle callback will be called. See SoCallbackAction.

When a callback returns TRUE, the corresponding shape is selected according to the selection policy. Then the selection stops processing the current shape's primitives and continues with the next shape in the scene graph. When a callback returns FALSE, the action continues normally to process the remaining shape's primitives, allowing you to filter or collect additional primitives.

The primitive filter callbacks are called only when the lassoPolicy is set to SoExtSelection::PART and the lassoMode is set to SoExtSelection::ALL_SHAPES.

It is the responsibility of the application to manage the primitive selection policy. Exactly like SoSelection, the node selection list can only handle paths to nodes and cannot store primitive detail information.

void SoExtSelection::useFastEditing ( SbBool  flg = TRUE  ) 

Sets whether the lasso should be drawn using fast editing.


When the application uses the FastEdit mode it must call this function first before calling any other function in this class. See also SoGLRenderAction::setFastEditSavePolicy for possible limitations. Default is FALSE.

SoDEPRECATED void SoExtSelection::useOverlay ( SbBool  flg = TRUE  )  [inline]

Sets whether the lasso is drawn in the overlay plane.


This only works if the graphics board supports overlay planes (for example the NVIDIA Quadro boards). Default is FALSE.

Deprecated:

Deprecated since Open Inventor 9610
Overlay feature is legacy, and no longer makes sense with current hardware.

Friends And Related Function Documentation

friend class SimplexSelectorHelper [friend]

Member Data Documentation

Specifies the lasso mode (whether ALL_SHAPES or only VISIBLE_SHAPES can be selected).

Use enum LassoMode. Default is ALL_SHAPES. It applies only when the lasso policy is FULL or PART. When the lasso mode is VISIBLE_SHAPES, you will only select visible shapes. That is, if a shape is within (or partially within) the lasso volume, but is hidden by another shape, it will not be selected. VISIBLE_SHAPES mode provides faster performance than ALL_SHAPES (the default).

The algorithm for the ALL_SHAPES mode is based on geometry projection while the VISIBLE_SHAPES mode uses offscreen rendering.

When using VISIBLE_SHAPES, none of the primitive selection callback nodes can be called. This means that you cannot retrieve selection details using this mode.

Unlike the ALL_SHAPES mode or the picking action, the VISIBLE_SHAPES mode does not allow you to select multiple overlapping shapes. You cannot select a shape obscured by another.

Specifies the lasso policy.

See description above. Use enum LassoPolicy. Default is FULL_BBOX.

Specifies lasso type (none, lasso, or rectangle).

Use enum LassoType. Default is NOLASSO.

The ExtSelection will traverse and test selection for each node of the scene graph.

The PreFilter event is raised for each node, before doing the intersection test, and can be used to skip a particular node to avoid doing costly computation. To skip a node, call the method PreFilterEventArg::discardNode() inside your callback.


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

Open Inventor by FEI reference manual, generated on 2 Sep 2019
Copyright © FEI S.A.S. All rights reserved.
http://www.openinventor.com/