public class SoExtSelection extends SoSelection
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: 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:
ExtSelection {
boundingBoxCaching | AUTO |
renderCulling | AUTO |
pickCulling | AUTO |
policy | SHIFT |
lassoType | NOLASSO |
lassoPolicy | FULL_BBOX |
lassoMode | ALL_SHAPES |
fastEditing | DISABLE |
See also:
SoRayPickAction
, SoSelection
, SoWinRenderArea
Modifier and Type | Class and Description |
---|---|
static class |
SoExtSelection.LassoModes
Lasso mode.
|
static class |
SoExtSelection.LassoPolicies
Lasso policy.
|
static class |
SoExtSelection.LassoTypes
Lasso type.
|
static class |
SoExtSelection.PreFilterEventArg
Structure given to callback when an event is raised.
|
static class |
SoExtSelection.ReturnTypes
Return type.
|
SoSelection.Policies
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
SoNode.RenderModes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFBool |
animateLasso
Controls lasso animation.
|
SoSFColor |
lassoColor
Color of lasso.
|
SoSFEnum<SoExtSelection.LassoModes> |
lassoMode
Specifies the lasso mode (whether ALL_SHAPES or only VISIBLE_SHAPES can be selected).
|
SoSFUShort |
lassoPattern
Stipple pattern.
|
SoSFInt32 |
lassoPatternScaleFactor
Stipple pattern scale factor.
|
SoSFEnum<SoExtSelection.LassoPolicies> |
lassoPolicy
Specifies the lasso policy.
|
SoSFEnum<SoExtSelection.LassoTypes> |
lassoType
Specifies lasso type (none, lasso, or rectangle).
|
SoSFFloat |
lassoWidth
Width of lasso.
|
SbEventHandler<SoExtSelection.PreFilterEventArg> |
onPreFilter
The ExtSelection will traverse each node of scene graph and test intersection against each nodes.
|
policy
boundingBoxCaching, fastEditing, pickCulling, renderCaching, renderCulling, renderUnitId
boundingBoxIgnoring
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoExtSelection()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
animateOverlayLasso()
Deprecated.
|
void |
animateOverlayLasso(boolean flg)
Deprecated.
As of Open Inventor 10000 Use animateLasso field instead.
|
java.nio.ShortBuffer |
getDirectLassoCoordsDC()
Returns the lasso coordinates in device coordinates.
|
java.nio.FloatBuffer |
getDirectLassoCoordsWC()
Returns the lasso coordinates in world coordinates.
|
SbColor |
getLassoColor()
Deprecated.
As of Open Inventor 10000 Use lassoColor field instead.
|
SbVec2s[] |
getLassoCoordsDC()
Returns the lasso coordinates in device coordinates.
|
SbVec3f[] |
getLassoCoordsWC()
Returns the lasso coordinates in world coordinates.
|
float |
getLassoWidth()
Deprecated.
As of Open Inventor 10000 Use lassoWidth field instead.
|
int |
getOverlayLassoColorIndex()
Deprecated.
As of Open Inventor 10000 No longer supported. Always returns 0.
|
short |
getOverlayLassoPattern()
Deprecated.
As of Open Inventor 10000 Use lassoPattern field instead.
|
SoSeparator |
getOverlaySceneGraph()
Returns the scene graph that should be passed to the render area function setOverlaySceneGraph .
|
java.util.Vector<SoPath> |
getSelectionPathList()
Returns paths list of selected objects.
|
SoNode |
getSelectionSceneGraph()
Returns the scenegraph displayed as "lasso" in fast edit mode.
|
boolean |
isOverlayLassoAnimated()
Deprecated.
As of Open Inventor 10000 Use animateLasso field instead.
|
boolean |
isUsingFastEditing()
Gets whether the lasso is drawn using fast editing.
|
void |
select(SoNode root,
SbVec2f[] lassoCoord,
SbViewportRegion viewport,
boolean shiftPressed)
Simulates interactive selection starting from the root node with the given lasso contour, updating the selection list and triggering any associated callback .
|
void |
setLassoColor(SbColor c)
Deprecated.
As of Open Inventor 10000 Use lassoColor field instead.
|
void |
setLassoWidth(float width)
Deprecated.
As of Open Inventor 10000 Use lassoWidth field instead.
|
void |
setOverlayLassoColorIndex(int index)
Deprecated.
As of Open Inventor 10000 No longer supported. Calling this method does nothing.
|
void |
setOverlayLassoPattern(short pattern)
Deprecated.
As of Open Inventor 10000 Use lassoPattern field instead.
|
void |
setSelectionSceneGraph(SoNode sceneGraph)
Sets the scenegraph to be displayed as "lasso" in fast edit mode.
|
void |
useFastEditing()
Calls useFastEditing(true).
|
void |
useFastEditing(boolean flg)
Sets whether the lasso should be drawn using fast editing.
|
addChangeCallback, addChangeCallback, addDeselectionCallback, addDeselectionCallback, addFinishCallback, addFinishCallback, addSelectionCallback, addSelectionCallback, addStartCallback, addStartCallback, deselect, deselect, deselect, deselectAll, getList, getNumSelected, getPath, getPickRadius, getValueAt, isPickMatching, isSelected, isSelected, removeChangeCallback, removeChangeCallback, removeDeselectionCallback, removeDeselectionCallback, removeFinishCallback, removeFinishCallback, removeSelectionCallback, removeSelectionCallback, removeStartCallback, removeStartCallback, select, select, setPickFilterCallback, setPickFilterCallback, setPickFilterCallback, setPickMatching, setPickRadius, toggle, toggle
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
getNativeResourceHandle
public final SoSFEnum<SoExtSelection.LassoTypes> lassoType
public final SoSFEnum<SoExtSelection.LassoPolicies> lassoPolicy
public final SoSFEnum<SoExtSelection.LassoModes> lassoMode
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.
public final SoSFBool animateLasso
public final SoSFColor lassoColor
public final SoSFFloat lassoWidth
SbViewportRegion
) is also 72. So effectively line width is specified in pixels unless the application sets a different pixels-per-inch value.
Please see the notes in the class description for more information.
public final SoSFUShort lassoPattern
The line pattern can be stretched using the #linePatternScaleFactor field.
public final SoSFInt32 lassoPatternScaleFactor
lassoPattern
) by multiplying each subseries of consecutive 1s and 0s. Scale factors are clamped to lie between 1 and 255. Default is 1.
public final SbEventHandler<SoExtSelection.PreFilterEventArg> onPreFilter
public void useFastEditing()
@Deprecated public void animateOverlayLasso()
@Deprecated public void setOverlayLassoColorIndex(int index)
@Deprecated public int getOverlayLassoColorIndex()
@Deprecated public SbColor getLassoColor()
@Deprecated public void setLassoColor(SbColor c)
public SoSeparator getOverlaySceneGraph()
public void select(SoNode root, SbVec2f[] lassoCoord, SbViewportRegion viewport, boolean shiftPressed)
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.
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!.
public boolean isUsingFastEditing()
public void useFastEditing(boolean flg)
SoGLRenderAction.setFastEditSavePolicy
for possible limitations. Default is false.public java.nio.FloatBuffer getDirectLassoCoordsWC()
public void setSelectionSceneGraph(SoNode sceneGraph)
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".
public SbVec3f[] getLassoCoordsWC()
public java.nio.ShortBuffer getDirectLassoCoordsDC()
public SbVec2s[] getLassoCoordsDC()
public SoNode getSelectionSceneGraph()
public java.util.Vector<SoPath> getSelectionPathList()
@Deprecated public void setOverlayLassoPattern(short pattern)
@Deprecated public float getLassoWidth()
@Deprecated public void setLassoWidth(float width)
@Deprecated public boolean isOverlayLassoAnimated()
@Deprecated public void animateOverlayLasso(boolean flg)
@Deprecated public short getOverlayLassoPattern()
Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com