Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoExtSelection.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Fabien ARNAUD (MMM yyyy)
22** Modified by : Christophe OGNIER (MMM yyyy)
23** Modified by : Daniel LICHAU (update) * (MMM yyyy)
24**=======================================================================*/
25
26#ifndef _SO_EXTENDED_SELECTION_H_
27#define _SO_EXTENDED_SELECTION_H_
28
29//------------------------------------------------------------------------------
30//Include files
31
39#include <Inventor/STL/vector>
40#include <Inventor/misc/SoRef.h>
42#include <Inventor/SbEventArg.h>
44
45//------------------------------------------------------------------------------
46// Class declaration
47class SoCamera;
48class SoSeparator;
49class SoCoordinate3;
51class SoMaterial;
52class SoPath;
53class LassoRenderer;
55class LassoPointsWrapper;
56class MatricesEvaluator;
57class SbPlanarConvexPolygon;
58class SoExtSelection;
59
61
62
188
190 SO_PIMPL_PUBLIC_HEADER( SoExtSelection );
191
192 //============================================================================
193 public:
194
206
218
231
237
243
269
275
281
294
309
317
339
344
353
358
365
366#if 1 SoDEPRECATED
373SoDEPRECATED
380SoDEPRECATED
388SoDEPRECATED
395SoDEPRECATED
401 void setLassoWidth(float width);
402SoDEPRECATED
408SoDEPRECATED
416 void setOverlayLassoPattern(unsigned short pattern);
417SoDEPRECATED
423 unsigned short getOverlayLassoPattern();
424SoDEPRECATED
431SoDEPRECATED
437
438#endif
461 void select(SoNode *root, int numCoord, SbVec2f *lassoCoord,
462 const SbViewportRegion &viewport, SbBool shiftPressed);
463
468 typedef SbBool SoExtSelectionTriangleCB(void *userData,
469 SoCallbackAction *action,
470 const SoPrimitiveVertex *v1,
471 const SoPrimitiveVertex *v2,
472 const SoPrimitiveVertex *v3);
477 typedef SbBool SoExtSelectionLineSegmentCB(void *userData,
478 SoCallbackAction *action,
479 const SoPrimitiveVertex *v1,
480 const SoPrimitiveVertex *v2);
485 typedef SbBool SoExtSelectionPointCB(void *userData,
486 SoCallbackAction *action,
487 const SoPrimitiveVertex *v1);
488
505 typedef SbBool SelectionEventCallback( const SbVec2s& position, const SbVec3f& scenePosition,
506 SoExtSelection* selection, void* userData );
507
514 virtual void addChild( SoNode *child );
515
522 public:
523
526 :m_path(path), m_source(source), m_isSkipped(false)
527 {}
528
531
533 SoExtSelection* getSource() const { return m_source; }
534
537 const SoNode* getNode() const { return m_path->getTail(); }
538
540 const SoPath* getPath() const { return m_path; }
541
543 void skipNode() { m_isSkipped = true; }
544
546 SbBool isNodeSkipped() const { return m_isSkipped; }
547
548 private:
549
550 SoPath* m_path;
551 SoExtSelection* m_source;
552 SbBool m_isSkipped;
553 };
554
563
581 virtual void setSelectionSceneGraph( SoNode* sceneGraph );
582
589
595 virtual void setStartSelectionCallback( SelectionEventCallback* callback, void* userData = NULL );
596
602 virtual void setEndSelectionCallback( SelectionEventCallback* callback, void* userData = NULL );
603
610 virtual void setMovingSelectionCallback( SelectionEventCallback* callback, void* userData = NULL );
611
637 void setTriangleFilterCallback(SoExtSelectionTriangleCB *cb,
638 void *userData = NULL);
639
644 void setLineSegmentFilterCallback(SoExtSelectionLineSegmentCB *cb,
645 void *userData = NULL);
650 void setPointFilterCallback(SoExtSelectionPointCB *cb,
651 void *userData = NULL);
652
658 const SbVec2s *getLassoCoordsDC(int &numCoords);
659
665 const SbVec3f *getLassoCoordsWC(int &numCoords);
666
671
672 // Routines to add callbacks for checked primitives
673 //(triangles, line segments, and points) for all shapes.
674
675 private:
676 // Traversal routine for SoHandleEventAction - this will call
677 // action->setHandled() if the event is handled
678 virtual void handleEvent(SoHandleEventAction *action);
679 virtual void search(SoSearchAction *action);
680 virtual void GLRender(SoGLRenderAction *action);
681 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
682
683 private:
684 static void initClass();
685 static void exitClass();
686
687 virtual void notify( SoNotList* list );
688
689 void setSelection( SbBool on );
690 SbBool getSelection() const;
691
692 //============================================================================
693 private:
694
695 // Destructor ----------------------------------------------------------------
696 // Private to keep people from trying to delete
697 // nodes, rather than using the reference count mechanism.
698 virtual ~SoExtSelection();
699
700 private:
701 void commonConstructor();
702};
703
704#endif // _SO_EXTENDED_SELECTION_H_
705
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
SO_PIMPL_PUBLIC_DECLARATION(SoFileDataAdapter)
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
Color vector class.
Definition SbColor.h:82
Base class for all event arguments.
Definition SbEventArg.h:41
Class representing an event.
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:700
3D vector class.
Definition SbVec.h:932
Class for representing a viewport.
Performs a generic traversal of a scene graph or path.
Abstract base class for camera nodes.
Definition SoCamera.h:188
Coordinate point node.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Selection node t...
virtual void setMovingSelectionCallback(SelectionEventCallback *callback, void *userData=NULL)
Sets the callback called when the mouse is moved in selection mode.
SoSFEnum lassoPolicy
Specifies the lasso policy.
void 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,...
virtual void setStartSelectionCallback(SelectionEventCallback *callback, void *userData=NULL)
Sets the callback called when the mouse button is clicked in selection mode.
SoSFColor lassoColor
Color of lasso.
SoSeparator * getOverlaySceneGraph()
Returns the scene graph that should be passed to the render area function setOverlaySceneGraph .
LassoPolicy
Lasso policy.
@ FULL_BBOX
Full bounding box (default)
@ PART_BBOX
Partial bounding box.
SoDEPRECATED void setOverlayLassoPattern(unsigned short pattern)
Sets the lasso stipple pattern.
virtual void addChild(SoNode *child)
Adds a child at the end of the list of children.
SoSFUShort lassoPattern
Stipple pattern.
void useFastEditing(SbBool flg=TRUE)
Sets whether the lasso should be drawn using fast editing.
SoSFEnum lassoMode
Specifies the lasso mode (whether ALL_SHAPES or only VISIBLE_SHAPES can be selected).
SoDEPRECATED float getLassoWidth()
Gets the lasso line width.
SoDEPRECATED int getOverlayLassoColorIndex()
Gets the lasso color index.
SoDEPRECATED unsigned short getOverlayLassoPattern()
Gets the lasso stipple pattern.
const SbVec3f * getLassoCoordsWC(int &numCoords)
Returns the lasso coordinates in world coordinates.
SbBool isUsingFastEditing()
Gets whether the lasso is drawn using fast editing.
SoSFInt32 lassoPatternScaleFactor
Stipple pattern scale factor.
SbBool SoExtSelectionPointCB(void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1)
ReturnType
Return type.
@ 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.
@ NOSELECT_CONTINUE
same as FALSE - Do not select the node, but continue with node's next triangle/line/point
SoSFBool animateLasso
Controls lasso animation.
SoDEPRECATED void setLassoWidth(float width)
Sets the lasso line width.
SoDEPRECATED SbColor getLassoColor()
Gets the lasso color.
void setTriangleFilterCallback(SoExtSelectionTriangleCB *cb, void *userData=NULL)
Sets the triangle filter callback .
SoDEPRECATED void setOverlayLassoColorIndex(int index)
Sets the lasso color index.
SoSFFloat lassoWidth
Width of lasso.
const SbVec2s * getLassoCoordsDC(int &numCoords)
Returns the lasso coordinates in device coordinates.
SbEventHandler< PreFilterEventArg & > onPreFilter
The ExtSelection will traverse each node of scene graph and test intersection against each nodes.
void setPointFilterCallback(SoExtSelectionPointCB *cb, void *userData=NULL)
Sets the point filter callback.
virtual void setEndSelectionCallback(SelectionEventCallback *callback, void *userData=NULL)
Sets the callback called when the mouse button is released in selection mode.
virtual void setSelectionSceneGraph(SoNode *sceneGraph)
Sets the scenegraph to be displayed as "lasso" in fast edit mode.
LassoMode
Lasso mode
@ VISIBLE_SHAPES
Only visible shapes can be selected.
@ ALL_SHAPES
All shapes can be selected.
const SoPathList & getSelectionPathList() const
Returns paths list of selected objects.
SbBool SoExtSelectionLineSegmentCB(void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2)
virtual SoNode * getSelectionSceneGraph() const
Returns the scenegraph displayed as "lasso" in fast edit mode.
void setLineSegmentFilterCallback(SoExtSelectionLineSegmentCB *cb, void *userData=NULL)
Sets the line segment filter callback.
SbBool SoExtSelectionTriangleCB(void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)
SoDEPRECATED SbBool isOverlayLassoAnimated()
Gets the the lasso animation flag.
SbBool SelectionEventCallback(const SbVec2s &position, const SbVec3f &scenePosition, SoExtSelection *selection, void *userData)
This is the declaration to use for selection event callback functions.
SoExtSelection()
Constructor.
SoSFEnum lassoType
Specifies lasso type (none, lasso, or rectangle).
SoDEPRECATED void animateOverlayLasso(SbBool flg=TRUE)
Sets the the lasso animation flag.
LassoType
Lasso type.
@ RECTANGLE
Rectangle.
@ NOLASSO
No lasso (default)
SoDEPRECATED void setLassoColor(SbColor c)
Sets the lasso color.
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Allows nodes in a graph to receive input events.
Surface material definition node.
Definition SoMaterial.h:186
Abstract base class for all database nodes.
Definition SoNode.h:145
Orthographic camera node.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Maintains a list of pointers to paths.
Definition SoPathList.h:81
Represents a vertex of a generated primitive.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an RGB color.
Definition SoSFColor.h:82
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing an unsigned short integer.
Definition SoSFUShort.h:79
Searches for nodes in a scene graph.
Manages a list of selected objects.
Group node that saves and restores traversal state.
int SbBool
Boolean type.
Definition SbBase.h:87
void notify(SoNotList *list)
Structure given to callback when an event is raised.
PreFilterEventArg(SoPath *path, SoExtSelection *source)
constructor
SoExtSelection * getSource() const
Returns the ExtSelection.
const SoPath * getPath() const
Returns path to node that will be traversed just after event is called.
const SoNode * getNode() const
Returns node that will be traversed just after event is called.
SbBool isNodeSkipped() const
Returns if node must be skipped for traversal.
void skipNode()
Don't traverse the node returned by getNode().