Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoDragger.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul Isaacs (MMM yyyy)
25** Modified by : David Mott (MMM yyyy)
26** Modified by : Howard Look (MMM yyyy)
27**=======================================================================*/
28/*=======================================================================
29 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
30 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
31 *** ***
32 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
33 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
34 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
35 *** ***
36 *** RESTRICTED RIGHTS LEGEND ***
37 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
38 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
39 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
40 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
41 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
42 *** ***
43 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
44 *** BORDEAUX, FRANCE ***
45 *** ALL RIGHTS RESERVED ***
46**=======================================================================*/
47/*=======================================================================
48** Modified by : VSG (MMM YYYY)
49**=======================================================================*/
50
51
52#ifndef _SO_DRAGGER_
53#define _SO_DRAGGER_
54
55#include <Inventor/SbBox.h>
57#include <Inventor/SbLinear.h>
63
64
65class SoPickedPoint;
66class SoAction;
70class SoSearchAction;
71class SoEvent;
72class SoPath;
73class SoTempPath;
74class SbPList;
75
76class SoDragger; // forward reference
77
78// The following typedef is used in defining the callback function lists.
82typedef void SoDraggerCB(void *userData, SoDragger *dragger );
83
85//
86// Class: SoDragger
87//
88// Base class for draggers which are operated by a start (mouse down)
89// followed by dragging, followed by end (mouse up).
90//
92
535
537
538 SO_KIT_CATALOG_ENTRY_HEADER(motionMatrix);
539
540 public:
541
546
556
557 // Dragger Callbacks
558 // In all cases, the callback data will be a pointer to the dragger
559 // that caused the callback. Each type of callback maintains a list of
560 // callbacks, so many callback functions may be registered, if desired.
561
570 void addStartCallback(SoDraggerCB *f, void *userData = NULL);
571
576 void removeStartCallback(SoDraggerCB *f, void *userData = NULL);
577
584 void addMotionCallback(SoDraggerCB *f, void *userData = NULL);
585
590 void removeMotionCallback(SoDraggerCB *f, void *userData = NULL);
591
598 void addFinishCallback(SoDraggerCB *f, void *userData = NULL);
599
604 void removeFinishCallback(SoDraggerCB *f, void *userData = NULL);
605
613 void addValueChangedCallback(SoDraggerCB *f, void *userData = NULL);
614
619 void removeValueChangedCallback(SoDraggerCB *f, void *userData = NULL);
620
625 void setMinGesture(int pixels) { minGesture = (float)pixels; }
626
632 void setMinGesture(float pixels) { minGesture = pixels; }
633
638 int getMinGesture() const { return (int)minGesture; }
639
645 float getMinGestureFloat() const { return minGesture; }
646
651 static void setMinScale(float newMinScale);
652
656 static float getMinScale();
657
670
695
702
707
714
719
731 void setMotionMatrix( const SbMatrix &newMatrix );
732
746
747 private:
748
749 // In addition to the public callback functions, these callback
750 // functions can also be used by subclasses to find out when things
751 // have happened.
752
753 // otherEvent callbacks are called in response to events other than
754 // the button1 Press/Release and location/tracker.
755 void addOtherEventCallback(SoDraggerCB *f, void *userData = NULL);
756 void removeOtherEventCallback(SoDraggerCB *f, void *userData = NULL);
757 void clearOtherEventCallbacks();
758
759 // Compound draggers should call this for each child dragger
760 // so that user callbacks (valueChanged, start, motion, finish, other event)
761 // registered with the parent dragger will be invoked based on the child
762 // dragger. Also, this will add the 'transferMotion' callback as a
763 // valueChanged callback on the child. Child dragger enableCallbacks field
764 // will be automatically connected from parent dragger enableCallbacks field,
765 // so that when parent dragger enableCallbacks field is set, value is the same
766 // for child draggers
767 void registerChildDragger(SoDragger *child);
768 void unregisterChildDragger(SoDragger *child);
769
770 // These two routines tie the child to the parent, but WITHOUT the
771 // transferMotion callback. It is good
772 // for child draggers that need to move independently of their parents,
773 // but which should still call the parents (valueChanged, start, motion,
774 // end, and otherEvent) callbacks when they are dragged.
775 void registerChildDraggerMovingIndependently(SoDragger *child);
776 void unregisterChildDraggerMovingIndependently(SoDragger *child);
777
778 // Get the matrix which converts from one dragger space to another.
779 SbMatrix getLocalToWorldMatrix( SoAction* action = NULL );
780 SbMatrix getWorldToLocalMatrix( SoAction* action = NULL );
781
782 // Returns the starting point in local coordinates.
783 SbVec3f getLocalStartingPoint();
784 // Returns the starting point in world coordinates.
785 SbVec3f getWorldStartingPoint();
786
787 // Get the matrix which converts from the space of one part into
788 // local space. Good to use if transforms occur between 'motionMatrix'
789 // and the space you want to work in.
790 // Note: This routine will try not to create parts that don't exist.
791 // Instead it finds the existing part that precedes it in traversal.
792 // But this only works if the partName is in this nodekit's catalog.
793 // If the part is nested within another kit below this one or
794 // sitting inside a list part, the part will be created when it
795 // doesn't exist.
796 void getPartToLocalMatrix( const SbName &partName,
797 SbMatrix &partToLocalMatrix,
798 SbMatrix &localToPartMatrix);
799
800 // Transforms a given matrix from one space into another space
801 void transformMatrixLocalToWorld( const SbMatrix &fromMatrix,
802 SbMatrix &toMatrix);
803 void transformMatrixWorldToLocal( const SbMatrix &fromMatrix,
804 SbMatrix &toMatrix);
805 void transformMatrixToLocalSpace( const SbMatrix &fromMatrix,
806 SbMatrix &toMatrix, const SbName &fromSpacePartName);
807
808 // Invokes the valueChangedCallbacks.
809 // These are invoked whenever setMotionMatrix() changes the motion matrix.
810 // If a subclass wishes to invoke the valueChanged callbacks for some
811 // other reason, they may call valueChanged(). Example: SoSpotLightDragger
812 // changes its angle field without altering the motionMatrix. So it
813 // calls valueChanged() to invoke callbacks.
814
815 void valueChanged();
816
817 // Used to calculate motion relative to the dragger's position at the
818 // beginning of the dragging.
819 const SbMatrix &getStartMotionMatrix() { return startMotionMatrix; }
820
821 // By default, saves the motionMatrix as the startMotionMatrix.
822 // Subclasses may want to save additional info. For example, the
823 // centerballDragger also saves the matrix that moves the center relative
824 // to the motionMatrix.
825 virtual void saveStartParameters();
826
827 // Information that's good to have during a valueChanged callback
828 const SoPath *getPickPath() const;
829 const SoEvent *getEvent() const;
830
831 // Creates a new path leading to this dragger, if the last path given by
832 // setTempPathToThis() is still valid. Will return NULL if not possible.
833 // You must ref() and unref() this new path if you
834 // don't want it (and all the nodes along it) to stay around forever.
835 SoPath *createPathToThis();
836
837 // Surrogate Pick Information. This is relevant if the we are dragging
838 // based on the pick of a surrogate part. This happens when you call
839 // SoInteractionKit::setPartAsPath() and thus specify a 'stand-in' path
840 // to pick when initiating a drag.
841 // Owner:
842 // Path to the InteractionKit that owns the surrogate part.
843 const SoPath *getSurrogatePartPickedOwner() const
844 { return pathToSurrogatePickOwner;}
845 // Name:
846 // Name of the surrogate part within the owners list.
847 const SbName &getSurrogatePartPickedName() const
848 { return surrogateNameInPickOwner; }
849 // SurrogatePath:
850 // The owner's surrogate path for this name. This path may
851 // differ from the actual pickPath, but it is guaranteed to
852 // be contained within the pickPath.
853 const SoPath *getSurrogatePartPickedPath() const
854 { return surrogatePathInPickOwner;}
855
856 // Set the point where the drag begins.
857 // The pickedPoint version would usually be the result of a pick.
858 void setStartingPoint( const SoPickedPoint *newPoint );
859 // The SbVec3f version would usually be a point saved from the end of
860 // another gesture. For example, when a modifier key goes down, we might
861 // save the current position and use it to begin another connected gesture.
862 void setStartingPoint( const SbVec3f &newPoint );
863
864 // Information about the window an event occurred in.
865 // Upon construction, the values are defaults.
866 // When drag begins, new values are taken from the handleEventAction
867 // and used for the duration of the drag.
868 // When drag ends, new values are taken from the final handleEventAction.
869 //
870 // DEPRECATED SINCE OIV 9.3
871 // Dragger must not store information related to viewer settings.
872 // In a multi-viewers configuration, draggers internal computation can be
873 // corrupted by using one of these values set from another viewer
874 // This has been solved by directly getting viewvolume and viewport from
875 // the state, or from the current action.
876
877#if 1 SoDEPRECATED
887 const SbViewVolume &getViewVolume() { return viewVolume; }
888SoDEPRECATED
890 void setViewVolume(const SbViewVolume &vol) { viewVolume = vol; }
891SoDEPRECATED
893 const SbViewportRegion &getViewportRegion() { return vpRegion; }
894SoDEPRECATED
896 void setViewportRegion(const SbViewportRegion &reg) { vpRegion = reg; }
897
898#endif
900 // Get the most recent handleEventAction.
901 SoHandleEventAction *getHandleEventAction() const { return handleEventAction; }
902 void setHandleEventAction( SoHandleEventAction *newAction );
903
904 // A path leading to 'this.' It is used to calculate the
905 // motionMatrix. It is set when a dragger first grabs event, through the
906 // handleEvent action, or by setCameraInfo() if NULL at the time.
907 void setTempPathToThis(const SoPath *somethingClose);
908
909 // Called when the dragger gains or loses status as "grabber" of events.
910 virtual void grabEventsSetup();
911 virtual void grabEventsCleanup();
912
913 // Changes only that part of the matrix for which this dragger has fields.
914 // For instance, when called by an SoTranslate1Dragger, any rotations and
915 // scales in the matrix will remain unchanged. But the translation will
916 // be replaced with value in the 'translation' field.
917 // First, factor mtx to get values for the following:
918 // trans, rot, scale, scaleOrient.
919 // If there's a center field, send it to the factor method.
920 // Replace any of these four values if fields are found named
921 // 'translation' 'scaleFactor' 'rotation' and/or 'scaleOrientation'
922 // Note that this could be all or none of the 4 listed.
923 // Values for which no fields are found remain unchanged.
924 // Build a new matrix using the new values. Some may be the originals
925 // and some may have been replaced.
926 void workFieldsIntoTransform( SbMatrix &mtx );
927
928 // Same as above, but values are given explicitly as pointers.
929 // If the pointers are NULL, the values in the matrix are not changed.
930 static void workValuesIntoTransform( SbMatrix &mtx,
931 const SbVec3f *translationPtr,
932 const SbRotation *rotationPtr,
933 const SbVec3f *scaleFactorPtr,
934 const SbRotation *scaleOrientationPtr,
935 const SbVec3f *centerPtr);
936
937 // Faster versions of getTransform() and factor() that take advantage of
938 // the case where there is no scaleOrientation. Reverts to slow method
939 // if it needs to.
940 // This method will not work if the matrix given contains any scales
941 // less than zero, and it does not check for that case.
942 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation,
943 SbRotation &rotation, SbVec3f &scaleFactor,
944 SbRotation &scaleOrientation,
945 const SbVec3f &center);
946 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation,
947 SbRotation &rotation, SbVec3f &scaleFactor,
948 SbRotation &scaleOrientation);
949
950 // Appends the given motion to the end of 'mtx'.
951 // 'conversion' transforms from the space the motion is defined in
952 // to the space 'mtx'.
953 static SbMatrix appendTranslation( const SbMatrix &mtx,
954 const SbVec3f &translation,
955 const SbMatrix *conversion = NULL );
956 static SbMatrix appendScale( const SbMatrix &mtx,
957 const SbVec3f &scale, const SbVec3f &scaleCenter,
958 const SbMatrix *conversion = NULL );
959 static SbMatrix appendRotation( const SbMatrix &mtx,
960 const SbRotation &rot, const SbVec3f &rotCenter,
961 const SbMatrix *conversion = NULL );
962
963 // Is the current tracker direct mode MOVE, ROTATE or FREE ?
964 SbBool isTrackerDirectMode() const;
965
966 private:
967 void GLRender(SoGLRenderAction *action);
968
969 static void initClass();
970 static void exitClass();
971 SB_THREAD_TLS_HEADER();
972
973 // Initialize ALL Inventor dragger classes
974 static void initClasses();
975 static void exitClasses();
976
977 // These control behavior of the rotational parts. If FRONT, no matter
978 // where you hit the dragger relative to its center, it will behave as if
979 // you are dragging from the front. If BACK, the rear. If USE_PICK,
980 // then it depends on the relationship between the picked point and the
981 // center of the dragger.
982 enum ProjectorFrontSetting {
983 FRONT, BACK, USE_PICK
984 };
985 void setFrontOnProjector( ProjectorFrontSetting newVal )
986 { projectorFrontSetting = newVal; }
987 ProjectorFrontSetting getFrontOnProjector() const
988 { return projectorFrontSetting;}
989
990 inline void setInteracting(bool flag) { m_draggerInteracting = flag; }
991
992 private:
993
994 // Constructor
995 SoDragger();
996
997 // Sensor attached to enableCallbacks field
998 SoFieldSensor* m_enableSensor;
999
1000 //Field sensor callback
1001 static void enableCB( void *, SoSensor * );
1002
1003 // Get the last known position of the locator (mouse).
1004 // 2D locater positions have (0,0) at lower-left, and are
1005 // relative to the viewport.
1006 // Normalized positions go from 0.0 to 1.0.
1007 // Regular positions go from 0 to (vpSize - 1)
1008 SbVec2f getNormalizedLocaterPosition();
1009 const SbVec2f& getLocaterPosition();
1010
1011 // Get the 3D tracker device's ray in world coords (new in v3.0)
1012 SbLine getTrackerRay();
1013
1014 // Get the position of the locater when dragging started.
1015 const SbVec2f& getStartLocaterPosition() const { return startLocater; }
1016
1017 // The start locater position is automatically set when button 1
1018 // goes down over the dragger. Subclasses may wish to reset it, such
1019 // as when a constraint key goes down during dragging.
1020 void setStartLocaterPosition(const SbVec2f& p) { startLocater = p; }
1021
1022 // Has the locater moved far enough from where it started to
1023 // choose a constraint gesture.
1024 SbBool isAdequateConstraintMotion();
1025
1026 // Given a pickPath and a surrogatePath, decides whether it should
1027 // grab based on the surrogate. First, the pickPath must
1028 // contain the surrogatePath, indicating that the surrogate was picked.
1029 // Second, we consider the part of the pickPath below the point where
1030 // the surrogatePath ends.
1031 // If this bottom section contains other draggers, then we will pass it up.
1032 // This is because the other draggers will want to grab when they find out
1033 // they've been picked.
1034 virtual SbBool shouldGrabBasedOnSurrogate( const SoPath *pickPath,
1035 const SoPath *surrogatePath );
1036
1037 //
1038 // The dragger looks in this action to get information about the camera
1039 // and the viewport. Usually the action used is just the handleEventAction.
1040 void setCameraInfo( SoAction *action );
1041
1042 // This is called during traversal by a HandleEventAction. It
1043 // calls ha->setHandled() if the event is handled.
1044 virtual void handleEvent(SoHandleEventAction *ha);
1045
1046 // This should be called by every child dragger of a compound dragger
1047 // as a result of compoundDragger->registerChildDragger( childDragger );
1048 // Called on the compoundDragger when childDragger's value changes.
1049 // Gets the motionMatrix from a the child dragger. Appends that change
1050 // to the parent dragger's savedStartMatrix, and sets the result as the
1051 // parent's motionMatrix.
1052 // Then, it zeros out the motionMatrix of the child dragger.
1053 void transferMotion(SoDragger *child);
1054
1055 // Set/get whether the dragger should be ignored during bounding
1056 // box calculations.
1057 void setIgnoreInBbox( SbBool newVal ) { ignoreInBbox = newVal; }
1058 SbBool isIgnoreInBbox() { return ignoreInBbox; }
1059
1060 // Implements getBoundingBox action. Differs from separator as follows:
1061 // If the 'ignoreInBbox' flag is set to TRUE, then it will return without
1062 // traversing children.
1063 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
1064
1065 // Stubs used by compound draggers to get user callbacks from
1066 // the child dragger
1067 static void childTransferMotionAndValueChangedCB(void *, SoDragger *);
1068 static void childValueChangedCB(void *, SoDragger *);
1069 static void childStartCB(void *, SoDragger *);
1070 static void childMotionCB(void *, SoDragger *);
1071 static void childFinishCB(void *, SoDragger *);
1072 static void childOtherEventCB(void *, SoDragger *);
1073
1074 // Called by the above child callbacks. Establishes which child dragger
1075 // is currently active. Set at beginning of child callback, returned to
1076 // original value at end. Returns current value at time method is called.
1077 void setActiveChildDragger( SoDragger *newChildDragger );
1078 SoDragger *getActiveChildDragger() const { return activeChildDragger; }
1079
1080 // Called by the SoBaseKit::write() method.
1081 //
1082 // Draggers don't want to write out fields if they have default vals.
1083 //
1084 // sets isActive to default if default and not connected.
1085 //
1086 // Looks for fields named:
1087 // 'rotation' with value SbRotation::identity()
1088 // 'translation' with value (0,0,0)
1089 // 'center' with value (0,0,0)
1090 // 'scaleFactor' with value (1,1,1)
1091 // and sets them to default if they are not connected from a field.
1092 // (most draggers are missing at least some of these, but thats okay)
1093 //
1094 // Then calls the method for SoInteractionKit.
1095 //
1096 // NOTE: Parts which are set to default may still wind up writing to file
1097 // if, for example, they lie on a path.
1098 virtual void setDefaultOnNonWritingFields();
1099
1100 // In tracker direct mode, apply motion of tracked input device
1101 // directly to dragger's motion matrix. (new for v5.0)
1102 virtual SbBool applyTrackerMotion();
1103
1104 virtual ~SoDragger();
1105
1106 // Class static thread local storage
1107 struct MTstruct {
1108 SoGetMatrixAction *m_matrixAction;
1109 SoSearchAction *m_searchAction;
1110 };
1111
1112 // Support for tracker direct mode (for immersive environments)
1113 //
1114 // Allows direct mode to be set for all draggers
1115 static TrackerDirectMode m_initialDirectMode;
1116 // Current direct mode for this dragger instance
1117 TrackerDirectMode m_directMode;
1118 // Default direct mode for this class of dragger
1119 TrackerDirectMode m_defaultDirectMode;
1120 // Saved start position of tracked input device
1121 SbVec3f m_trackerStartPos;
1122 // Saved start orientation of tracked input device
1123 SbRotation m_trackerStartRot;
1124
1125 SbViewVolume viewVolume; // view volume for xsection tests
1126 SbViewportRegion vpRegion; // view volume for xsection tests
1127
1128 private:
1129
1130 // lists of callback functions
1131 SoCallbackList *startCallbacks;
1132 SoCallbackList *motionCallbacks;
1133 SoCallbackList *finishCallbacks;
1134 SoCallbackList *valueChangedCallbacks;
1135
1136 SoCallbackList *otherEventCallbacks;
1137
1138 SbBool valueChangedCallbacksEnabled;
1139 SoDragger *activeChildDragger;
1140
1141 SoHandleEventAction *handleEventAction; // current event action
1142
1143 // A record of the world space point which initiated the dragging.
1144 // This might be set from a pickedPoint of a handleEventAction,
1145 // or explicitly from a given point when a meta-key callback
1146 // changes gestures mid-stream and wants to select its own transitional
1147 // starting point.
1148 SbVec3f startingWorldPoint;
1149
1150 // Used by parent draggers to save initial matrix when motion begins.
1151 SbMatrix startMotionMatrix;
1152
1153 // Where the locater was when dragging was initiated
1154 SbVec2f startLocater;
1155
1156
1157 // sets pick path and tempPathToThis
1158 void setPickPath(SoPath *newPickPath);
1159 SoPath *pickPath; // pick path to the dragger
1160
1161 // sets surrogate part picks.
1162 void setNoPickedSurrogate();
1163 void setPickedSurrogate( SoPath *pathToOwner, SbName &nameUsedByOwner,
1164 SoPath *pathUsedByOwner );
1165
1166 SbName surrogateNameInPickOwner;
1167 SoPath *pathToSurrogatePickOwner;
1168 SoPath *surrogatePathInPickOwner;
1169
1170 // A tempPath leading to 'this.' It is used to calculate the
1171 // motionMatrix. It is set when a dragger first grabs event, through the
1172 // handleEvent action, or by setCameraInfo() if NULL at the time.
1173 // A tempPath does not increase any ref counts, so keeping this path
1174 // will not prevent this node from being deleted. However, we must be
1175 // very careful before using it, since some nodes my get deleted out from
1176 // under us. The variable tempPathNumKidsHack helps us fix up paths
1177 // that have changed since the path was set.
1178 SoTempPath *tempPathToThis;
1179 SbPList *tempPathNumKidsHack;
1180 // Determines if this path can actually be used. Since a temp path
1181 // does not ref the nodes, some nodes my get deleted out from
1182 // under us. This routine makes sure that everythings all right.
1183 SbBool isTempPathToThisOk();
1184 // Creates a temp path copy of the full path.
1185 SoTempPath *createTempPathFromFullPath( const SoFullPath *fp ) const;
1186
1187 // Minimum number of pixels to move before choosing a constraint
1188 // based on the gesture.
1189 float minGesture;
1190
1191 // The smallest scale that any dragger will write. If the user attempts
1192 // to go below this amount, the dragger will set it to this minimum.
1193 // Default is .0001
1194 static float minScale;
1195
1196 // We keep these matrices and their inverses around
1197 // to use when converting between spaces. The four
1198 // pairs are cached; the pair becomes invalud when its
1199 // valid flag is set to FALSE.
1200
1201 // Called to make sure these matrixes are up to date.
1202 void validateMatrices( SoAction* );
1203
1204 // These matrices are ones that are commonly queried by
1205 // subclasses. So, we cache them.
1206 // Two things determine the localToWorld matrix. The pathToThis and
1207 // the motionMatrix. If either value is invalid, we need to recalculate.
1208 // But depending on which one it is, we either need to run a matrix
1209 // action on the pick path or just on the motionMatrix.
1210 SbBool cachedPathToThisValid;
1211 SbBool cachedMotionMatrixValid;
1212 SbMatrix cachedMotionMatrix;
1213 // PostMotion is the matrix space just AFTER the motion matrix.
1214 SbMatrix postMotionToWorldMatrix;
1215 SbMatrix worldToPostMotionMatrix;
1216 // PreMotion is the matrix space just BEFORE the motion matrix.
1217 SbMatrix preMotionToWorldMatrix;
1218 SbMatrix worldToPreMotionMatrix;
1219
1220 // Used so that draggers don't try to include themselves
1221 // as part of their own sizing boxes. By default this is FALSE.
1222 SbBool ignoreInBbox;
1223
1224 // True if we are interacting in order to update the SoInteractionElement
1225 bool m_draggerInteracting;
1226
1227 ProjectorFrontSetting projectorFrontSetting;
1228};
1229
1230#endif /* _SO_DRAGGER_ */
1231
void SoDraggerCB(void *userData, SoDragger *dragger)
Definition SoDragger.h:82
#define SO_KIT_CATALOG_ENTRY_HEADER(partName)
Definition SoSubKit.h:107
#define SO_KIT_HEADER(className)
Definition SoSubKit.h:91
Directed line in 3D.
Definition SbLine.h:57
4x4 matrix class.
Definition SbMatrix.h:309
Character string stored in a hash table.
Definition SbName.h:162
List of generic (void *) pointers.
Definition SbPList.h:77
Class for representing a rotation.
Definition SbRotation.h:126
2D vector class.
Definition SbVec.h:76
3D vector class.
Definition SbVec.h:932
3D viewing volume class.
Class for representing a viewport.
Abstract base class for all actions.
Definition SoAction.h:132
Manages a list of callbacks and associated data.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:534
void setMinGesture(int pixels)
Sets the number of pixels of movement required to initiate a constraint gesture.
Definition SoDragger.h:625
void removeMotionCallback(SoDraggerCB *f, void *userData=NULL)
Removes motion callback.
void removeFinishCallback(SoDraggerCB *f, void *userData=NULL)
Removes finish callback.
SoSFBool enableCallbacks
If set to FALSE, motion, start and finish callbacks are disabled.
Definition SoDragger.h:555
SoSFBool isActive
TRUE when mouse is down and dragging, else FALSE.
Definition SoDragger.h:545
TrackerDirectMode getTrackerDirectMode() const
Get the current tracker direct mode for this dragger.
void setMinGesture(float pixels)
Float version of setMinGesture.
Definition SoDragger.h:632
void addFinishCallback(SoDraggerCB *f, void *userData=NULL)
Adds finish callback.
TrackerDirectMode
Tracker direct mode.
Definition SoDragger.h:672
@ NONE
Dragger will not use tracker values directly (default).
Definition SoDragger.h:676
@ MOVE
Dragger will use tracker position values directly.
Definition SoDragger.h:680
@ DEFAULT
Dragger will use its natural default direct behavior (which will be NONE, MOVE, ROTATE,...
Definition SoDragger.h:693
@ FREE
Dragger will use tracker position and orientation directly.
Definition SoDragger.h:688
@ ROTATE
Dragger will use tracker orientation values directly.
Definition SoDragger.h:684
void addStartCallback(SoDraggerCB *f, void *userData=NULL)
Adds start callback.
static TrackerDirectMode getInitialTrackerDirectMode()
Get the initial tracker direct mode.
void removeStartCallback(SoDraggerCB *f, void *userData=NULL)
Removes start callback.
float getMinGestureFloat() const
Float version of getMinGesture.
Definition SoDragger.h:645
void removeValueChangedCallback(SoDraggerCB *f, void *userData=NULL)
Removes value-changed callback.
static void setMinScale(float newMinScale)
Sets the smallest scale that any dragger will write.
void setMotionMatrix(const SbMatrix &newMatrix)
Set the motion matrix.
int getMinGesture() const
Gets the number of pixels of movement required to initiate a constraint gesture.
Definition SoDragger.h:638
void addMotionCallback(SoDraggerCB *f, void *userData=NULL)
Adds motion callback.
void addValueChangedCallback(SoDraggerCB *f, void *userData=NULL)
Adds value-changed callback.
SbBool enableValueChangedCallbacks(SbBool newVal)
You can temporarily disable a dragger's valueChangedCallbacks.
static float getMinScale()
Gets the smallest scale that any dragger will write.
const SbMatrix & getMotionMatrix()
Get the motion matrix.
static void setInitialTrackerDirectMode(TrackerDirectMode mode=DEFAULT)
Set the initial tracker direct mode for draggers not yet created.
void setTrackerDirectMode(TrackerDirectMode mode=DEFAULT)
Sets the tracker direct mode for this dragger (see description above).
Base class for all events.
Definition SoEvent.h:116
Sensor class that can be attached to Open Inventor fields.
Path that allows access to hidden children.
Definition SoPath.h:604
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Computes transformation matrix for a subgraph.
Allows nodes in a graph to receive input events.
Base class for all interaction nodekit classes.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Represents point on surface of picked object.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:97
int SbBool
Boolean type.
Definition SbBase.h:87