Class SoBoxHighlightRenderAction
SoBoxHighlightRenderAction is a render action which renders the specified scene graph, then renders wireframe boxes surrounding each selected object. If an SoGetBoundingBoxAction applied to a selected object produces an empty bounding box, no highlight is rendered for that object.
Selected objects are specified by the first selection node (SoSelection or SoExtSelection) node in the scene to which this action is applied. If there is no selection node in the scene graph, then no objects will be highlighted.
The application must explicitly tell Open Inventor to use a highlight render action in place of the default SoGLRenderAction in the SoSceneManager class using the setGLRenderAction() method. The viewer classes provide a convenience setGLRenderAction() method that calls SoSceneManager (see e.g.
invalid reference
SoWinRenderArea
For convenience, the viewer classes also provide the redrawOnSelectionChange() method. This method attaches a sensor to the specified selection node and automatically schedules a redraw if the set of selected objects is modified.
Other highlight effects are available including "halo" highlighting.
Here is an example of how a box highlight can be specified for a particular selection node and viewer:
// Viewer ViewerExaminer viewer = new ViewerExaminer(); // Set the highlight render action final RenderArea area = viewer.getRenderArea(); area.setGLRenderAction( new SoBoxHighlightRenderAction() ); // Scene graph SoSelection selectionNode = new SoSelection(); // Request automatic redraw when selection changes selectionNode.addChangeCallback(new SoSelectionClassCB() { public void invoke(SoSelection s) { area.scheduleRedraw(); } }); . . . viewer.setSceneGraph( selectionNode );
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.actions.SoGLRenderAction
SoGLRenderAction.AbortCodes, SoGLRenderAction.AutoCacheModes, SoGLRenderAction.FastEditSavePolicies, SoGLRenderAction.InvalidateCacheModes, SoGLRenderAction.TransparencyTypesNested classes/interfaces inherited from class com.openinventor.inventor.actions.SoAction
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndicesNested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand -
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SoBoxHighlightRenderAction(SbViewportRegion viewportRegion) Constructor which takes the normalSoGLRenderActionparameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidenableElement(Class<? extends Inventor> t, int stkIndex) getColor()Gets the color of the highlight.shortGets the line pattern of the highlight.floatGets the line width of the highlight.voidSets the color of the highlight.voidsetLinePattern(short pattern) Sets the line pattern of the highlight.voidsetLineWidth(float width) Sets the line width of the highlight.Methods inherited from class com.openinventor.inventor.actions.SoHighlightRenderAction
isVisible, setVisibleMethods inherited from class com.openinventor.inventor.actions.SoGLRenderAction
abortNow, enableDepthPeeling3D, generateCacheContext, getCache, getCacheContext, getCurPass, getDecimationPercentage, getDecimationType, getDelayedObjDepthWrite, getDepthPeelingPass, getFastEditSavePolicy, getFrameCounter, getInvalidateCacheMode, getLogicalViewportRegion, getNumPasses, getRenderingIsRemote, getSortedLayersNumPasses, getTransparencyType, getUpdateArea, getViewportRegion, handleTransparency, handleTransparency, handleTransparency, isAlphaTest, isDoingDepthPeeling, isPassUpdate, isSmoothing, isSortedLayersSupported, isSortedLayersSupported, isUsedCacheContext, resetFrameCounter, resetFrameCounter, setAlphaTest, setCache, setCacheContext, setDecimationValue, setDecimationValue, setDelayedObjDepthWrite, setFastEditSavePolicy, setFastEditSavePolicy, setInvalidateCacheMode, setLogicalViewportRegion, setNumPasses, setPassCallback, setPassCallback, setPassUpdate, setRenderingIsRemote, setSmoothing, setSortedLayersNumPasses, setTransparencyType, setUpdateArea, setViewportRegion, shouldAutoCacheMethods inherited from class com.openinventor.inventor.actions.SoAction
apply, apply, clearApplyResult, forwardTraversal, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getDistribMode, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRepMethods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoBoxHighlightRenderAction
Constructor which takes the normalSoGLRenderActionparameters. -
SoBoxHighlightRenderAction
public SoBoxHighlightRenderAction()Constructor.
-
-
Method Details
-
getLineWidth
public float getLineWidth()Gets the line width of the highlight. -
setColor
Sets the color of the highlight. Default is red (1,0,0) . Application is responsible for forcing a redraw of the scene to see the effects of this change. -
setLineWidth
public void setLineWidth(float width) Sets the line width of the highlight. Default is 3 . Application is responsible for forcing a redraw of the scene to see the effects of this change. -
enableElement
-
getLinePattern
public short getLinePattern()Gets the line pattern of the highlight. -
getColor
Gets the color of the highlight. -
setLinePattern
public void setLinePattern(short pattern) Sets the line pattern of the highlight. Default is solid, 0xffff . The pattern of bits in the passed variable specifies the pattern of the line. SeeSoDrawStylefor a description. Application is responsible for forcing a redraw of the scene to see the effects of this change.
-