00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul Isaacs (MMM yyyy) 00025 ** Modified by : David Mott (MMM yyyy) 00026 ** Modified by : Howard Look (MMM yyyy) 00027 **=======================================================================*/ 00028 /*======================================================================= 00029 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00030 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00031 *** *** 00032 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00033 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00034 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00035 *** *** 00036 *** RESTRICTED RIGHTS LEGEND *** 00037 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00038 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00039 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00040 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00041 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00042 *** *** 00043 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00044 *** BORDEAUX, FRANCE *** 00045 *** ALL RIGHTS RESERVED *** 00046 **=======================================================================*/ 00047 /*======================================================================= 00048 ** Modified by : VSG (MMM YYYY) 00049 **=======================================================================*/ 00050 00051 00052 #ifndef _SO_DRAGGER_ 00053 #define _SO_DRAGGER_ 00054 00055 #include <Inventor/SbBox.h> 00056 #include <Inventor/SbViewportRegion.h> 00057 #include <Inventor/SbLinear.h> 00058 #include <Inventor/nodekits/SoInteractionKit.h> 00059 #include <Inventor/misc/SoCallbackList.h> 00060 #include <Inventor/fields/SoSFBool.h> 00061 #include <Inventor/nodes/SoMatrixTransform.h> 00062 #include <Inventor/nodes/SoScale.h> 00063 00064 00065 class SoPickedPoint; 00066 class SoAction; 00067 class SoHandleEventAction; 00068 class SoGetBoundingBoxAction; 00069 class SoGetMatrixAction; 00070 class SoSearchAction; 00071 class SoEvent; 00072 class SoPath; 00073 class SoTempPath; 00074 class SbPList; 00075 00076 class SoDragger; // forward reference 00077 00078 // The following typedef is used in defining the callback function lists. 00082 typedef void SoDraggerCB(void *userData, SoDragger *dragger ); 00083 00085 // 00086 // Class: SoDragger 00087 // 00088 // Base class for draggers which are operated by a start (mouse down) 00089 // followed by dragging, followed by end (mouse up). 00090 // 00092 00534 class SoDragger : public SoInteractionKit { 00535 00536 SO_KIT_HEADER(SoDragger); 00537 00538 SO_KIT_CATALOG_ENTRY_HEADER(motionMatrix); 00539 00540 public: 00541 00545 SoSFBool isActive; 00546 00555 SoSFBool enableCallbacks; 00556 00557 // Dragger Callbacks 00558 // In all cases, the callback data will be a pointer to the dragger 00559 // that caused the callback. Each type of callback maintains a list of 00560 // callbacks, so many callback functions may be registered, if desired. 00561 00570 void addStartCallback(SoDraggerCB *f, void *userData = NULL); 00571 00576 void removeStartCallback(SoDraggerCB *f, void *userData = NULL); 00577 00584 void addMotionCallback(SoDraggerCB *f, void *userData = NULL); 00585 00590 void removeMotionCallback(SoDraggerCB *f, void *userData = NULL); 00591 00598 void addFinishCallback(SoDraggerCB *f, void *userData = NULL); 00599 00604 void removeFinishCallback(SoDraggerCB *f, void *userData = NULL); 00605 00613 void addValueChangedCallback(SoDraggerCB *f, void *userData = NULL); 00614 00619 void removeValueChangedCallback(SoDraggerCB *f, void *userData = NULL); 00620 00625 void setMinGesture(int pixels) { minGesture = (float)pixels; } 00626 00632 void setMinGesture(float pixels) { minGesture = pixels; } 00633 00638 int getMinGesture() const { return (int)minGesture; } 00639 00645 float getMinGestureFloat() const { return minGesture; } 00646 00651 static void setMinScale(float newMinScale); 00652 00656 static float getMinScale(); 00657 00669 SbBool enableValueChangedCallbacks( SbBool newVal ); 00670 00672 enum TrackerDirectMode { 00676 NONE, 00680 MOVE, 00684 ROTATE, 00688 FREE, 00693 DEFAULT 00694 }; 00695 00701 void setTrackerDirectMode( TrackerDirectMode mode = DEFAULT ); 00702 00706 TrackerDirectMode getTrackerDirectMode() const; 00707 00713 static void setInitialTrackerDirectMode( TrackerDirectMode mode = DEFAULT ); 00714 00718 static TrackerDirectMode getInitialTrackerDirectMode(); 00719 00731 void setMotionMatrix( const SbMatrix &newMatrix ); 00732 00745 const SbMatrix &getMotionMatrix(); 00746 00747 private: 00748 00749 // In addition to the public callback functions, these callback 00750 // functions can also be used by subclasses to find out when things 00751 // have happened. 00752 00753 // otherEvent callbacks are called in response to events other than 00754 // the button1 Press/Release and location/tracker. 00755 void addOtherEventCallback(SoDraggerCB *f, void *userData = NULL); 00756 void removeOtherEventCallback(SoDraggerCB *f, void *userData = NULL); 00757 void clearOtherEventCallbacks(); 00758 00759 // Compound draggers should call this for each child dragger 00760 // so that user callbacks (valueChanged, start, motion, finish, other event) 00761 // registered with the parent dragger will be invoked based on the child 00762 // dragger. Also, this will add the 'transferMotion' callback as a 00763 // valueChanged callback on the child. Child dragger enableCallbacks field 00764 // will be automatically connected from parent dragger enableCallbacks field, 00765 // so that when parent dragger enableCallbacks field is set, value is the same 00766 // for child draggers 00767 void registerChildDragger(SoDragger *child); 00768 void unregisterChildDragger(SoDragger *child); 00769 00770 // These two routines tie the child to the parent, but WITHOUT the 00771 // transferMotion callback. It is good 00772 // for child draggers that need to move independently of their parents, 00773 // but which should still call the parents (valueChanged, start, motion, 00774 // end, and otherEvent) callbacks when they are dragged. 00775 void registerChildDraggerMovingIndependently(SoDragger *child); 00776 void unregisterChildDraggerMovingIndependently(SoDragger *child); 00777 00778 // Get the matrix which converts from one dragger space to another. 00779 SbMatrix getLocalToWorldMatrix( SoAction* action = NULL ); 00780 SbMatrix getWorldToLocalMatrix( SoAction* action = NULL ); 00781 00782 // Returns the starting point in local coordinates. 00783 SbVec3f getLocalStartingPoint(); 00784 // Returns the starting point in world coordinates. 00785 SbVec3f getWorldStartingPoint(); 00786 00787 // Get the matrix which converts from the space of one part into 00788 // local space. Good to use if transforms occur between 'motionMatrix' 00789 // and the space you want to work in. 00790 // Note: This routine will try not to create parts that don't exist. 00791 // Instead it finds the existing part that precedes it in traversal. 00792 // But this only works if the partName is in this nodekit's catalog. 00793 // If the part is nested within another kit below this one or 00794 // sitting inside a list part, the part will be created when it 00795 // doesn't exist. 00796 void getPartToLocalMatrix( const SbName &partName, 00797 SbMatrix &partToLocalMatrix, 00798 SbMatrix &localToPartMatrix); 00799 00800 // Transforms a given matrix from one space into another space 00801 void transformMatrixLocalToWorld( const SbMatrix &fromMatrix, 00802 SbMatrix &toMatrix); 00803 void transformMatrixWorldToLocal( const SbMatrix &fromMatrix, 00804 SbMatrix &toMatrix); 00805 void transformMatrixToLocalSpace( const SbMatrix &fromMatrix, 00806 SbMatrix &toMatrix, const SbName &fromSpacePartName); 00807 00808 // Invokes the valueChangedCallbacks. 00809 // These are invoked whenever setMotionMatrix() changes the motion matrix. 00810 // If a subclass wishes to invoke the valueChanged callbacks for some 00811 // other reason, they may call valueChanged(). Example: SoSpotLightDragger 00812 // changes its angle field without altering the motionMatrix. So it 00813 // calls valueChanged() to invoke callbacks. 00814 00815 void valueChanged(); 00816 00817 // Used to calculate motion relative to the dragger's position at the 00818 // beginning of the dragging. 00819 const SbMatrix &getStartMotionMatrix() { return startMotionMatrix; } 00820 00821 // By default, saves the motionMatrix as the startMotionMatrix. 00822 // Subclasses may want to save additional info. For example, the 00823 // centerballDragger also saves the matrix that moves the center relative 00824 // to the motionMatrix. 00825 virtual void saveStartParameters(); 00826 00827 // Information that's good to have during a valueChanged callback 00828 const SoPath *getPickPath() const; 00829 const SoEvent *getEvent() const; 00830 00831 // Creates a new path leading to this dragger, if the last path given by 00832 // setTempPathToThis() is still valid. Will return NULL if not possible. 00833 // You must ref() and unref() this new path if you 00834 // don't want it (and all the nodes along it) to stay around forever. 00835 SoPath *createPathToThis(); 00836 00837 // Surrogate Pick Information. This is relevant if the we are dragging 00838 // based on the pick of a surrogate part. This happens when you call 00839 // SoInteractionKit::setPartAsPath() and thus specify a 'stand-in' path 00840 // to pick when initiating a drag. 00841 // Owner: 00842 // Path to the InteractionKit that owns the surrogate part. 00843 const SoPath *getSurrogatePartPickedOwner() const 00844 { return pathToSurrogatePickOwner;} 00845 // Name: 00846 // Name of the surrogate part within the owners list. 00847 const SbName &getSurrogatePartPickedName() const 00848 { return surrogateNameInPickOwner; } 00849 // SurrogatePath: 00850 // The owner's surrogate path for this name. This path may 00851 // differ from the actual pickPath, but it is guaranteed to 00852 // be contained within the pickPath. 00853 const SoPath *getSurrogatePartPickedPath() const 00854 { return surrogatePathInPickOwner;} 00855 00856 // Set the point where the drag begins. 00857 // The pickedPoint version would usually be the result of a pick. 00858 void setStartingPoint( const SoPickedPoint *newPoint ); 00859 // The SbVec3f version would usually be a point saved from the end of 00860 // another gesture. For example, when a modifier key goes down, we might 00861 // save the current position and use it to begin another connected gesture. 00862 void setStartingPoint( const SbVec3f &newPoint ); 00863 00864 // Information about the window an event occurred in. 00865 // Upon construction, the values are defaults. 00866 // When drag begins, new values are taken from the handleEventAction 00867 // and used for the duration of the drag. 00868 // When drag ends, new values are taken from the final handleEventAction. 00869 // 00870 // DEPRECATED SINCE OIV 9.3 00871 // Dragger must not store information related to viewer settings. 00872 // In a multi-viewers configuration, draggers internal computation can be 00873 // corrupted by using one of these values set from another viewer 00874 // This has been solved by directly getting viewvolume and viewport from 00875 // the state, or from the current action. 00876 00877 #if 1 SoDEPRECATED 00887 const SbViewVolume &getViewVolume() { return viewVolume; } 00888 SoDEPRECATED 00890 void setViewVolume(const SbViewVolume &vol) { viewVolume = vol; } 00891 SoDEPRECATED 00893 const SbViewportRegion &getViewportRegion() { return vpRegion; } 00894 SoDEPRECATED 00896 void setViewportRegion(const SbViewportRegion ®) { vpRegion = reg; } 00897 00898 #endif 00900 // Get the most recent handleEventAction. 00901 SoHandleEventAction *getHandleEventAction() const { return handleEventAction; } 00902 void setHandleEventAction( SoHandleEventAction *newAction ); 00903 00904 // A path leading to 'this.' It is used to calculate the 00905 // motionMatrix. It is set when a dragger first grabs event, through the 00906 // handleEvent action, or by setCameraInfo() if NULL at the time. 00907 void setTempPathToThis(const SoPath *somethingClose); 00908 00909 // Called when the dragger gains or loses status as "grabber" of events. 00910 virtual void grabEventsSetup(); 00911 virtual void grabEventsCleanup(); 00912 00913 // Changes only that part of the matrix for which this dragger has fields. 00914 // For instance, when called by an SoTranslate1Dragger, any rotations and 00915 // scales in the matrix will remain unchanged. But the translation will 00916 // be replaced with value in the 'translation' field. 00917 // First, factor mtx to get values for the following: 00918 // trans, rot, scale, scaleOrient. 00919 // If there's a center field, send it to the factor method. 00920 // Replace any of these four values if fields are found named 00921 // 'translation' 'scaleFactor' 'rotation' and/or 'scaleOrientation' 00922 // Note that this could be all or none of the 4 listed. 00923 // Values for which no fields are found remain unchanged. 00924 // Build a new matrix using the new values. Some may be the originals 00925 // and some may have been replaced. 00926 void workFieldsIntoTransform( SbMatrix &mtx ); 00927 00928 // Same as above, but values are given explicitly as pointers. 00929 // If the pointers are NULL, the values in the matrix are not changed. 00930 static void workValuesIntoTransform( SbMatrix &mtx, 00931 const SbVec3f *translationPtr, 00932 const SbRotation *rotationPtr, 00933 const SbVec3f *scaleFactorPtr, 00934 const SbRotation *scaleOrientationPtr, 00935 const SbVec3f *centerPtr); 00936 00937 // Faster versions of getTransform() and factor() that take advantage of 00938 // the case where there is no scaleOrientation. Reverts to slow method 00939 // if it needs to. 00940 // This method will not work if the matrix given contains any scales 00941 // less than zero, and it does not check for that case. 00942 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation, 00943 SbRotation &rotation, SbVec3f &scaleFactor, 00944 SbRotation &scaleOrientation, 00945 const SbVec3f ¢er); 00946 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation, 00947 SbRotation &rotation, SbVec3f &scaleFactor, 00948 SbRotation &scaleOrientation); 00949 00950 // Appends the given motion to the end of 'mtx'. 00951 // 'conversion' transforms from the space the motion is defined in 00952 // to the space 'mtx'. 00953 static SbMatrix appendTranslation( const SbMatrix &mtx, 00954 const SbVec3f &translation, 00955 const SbMatrix *conversion = NULL ); 00956 static SbMatrix appendScale( const SbMatrix &mtx, 00957 const SbVec3f &scale, const SbVec3f &scaleCenter, 00958 const SbMatrix *conversion = NULL ); 00959 static SbMatrix appendRotation( const SbMatrix &mtx, 00960 const SbRotation &rot, const SbVec3f &rotCenter, 00961 const SbMatrix *conversion = NULL ); 00962 00963 // Is the current tracker direct mode MOVE, ROTATE or FREE ? 00964 SbBool isTrackerDirectMode() const; 00965 00966 private: 00967 void GLRender(SoGLRenderAction *action); 00968 00969 static void initClass(); 00970 static void exitClass(); 00971 SB_THREAD_TLS_HEADER(); 00972 00973 // Initialize ALL Inventor dragger classes 00974 static void initClasses(); 00975 static void exitClasses(); 00976 00977 // These control behavior of the rotational parts. If FRONT, no matter 00978 // where you hit the dragger relative to its center, it will behave as if 00979 // you are dragging from the front. If BACK, the rear. If USE_PICK, 00980 // then it depends on the relationship between the picked point and the 00981 // center of the dragger. 00982 enum ProjectorFrontSetting { 00983 FRONT, BACK, USE_PICK 00984 }; 00985 void setFrontOnProjector( ProjectorFrontSetting newVal ) 00986 { projectorFrontSetting = newVal; } 00987 ProjectorFrontSetting getFrontOnProjector() const 00988 { return projectorFrontSetting;} 00989 00990 inline void setInteracting(bool flag) { m_draggerInteracting = flag; } 00991 00992 private: 00993 00994 // Constructor 00995 SoDragger(); 00996 00997 // Sensor attached to enableCallbacks field 00998 SoFieldSensor* m_enableSensor; 00999 01000 //Field sensor callback 01001 static void enableCB( void *, SoSensor * ); 01002 01003 // Get the last known position of the locator (mouse). 01004 // 2D locater positions have (0,0) at lower-left, and are 01005 // relative to the viewport. 01006 // Normalized positions go from 0.0 to 1.0. 01007 // Regular positions go from 0 to (vpSize - 1) 01008 SbVec2f getNormalizedLocaterPosition(); 01009 const SbVec2f& getLocaterPosition(); 01010 01011 // Get the 3D tracker device's ray in world coords (new in v3.0) 01012 SbLine getTrackerRay(); 01013 01014 // Get the position of the locater when dragging started. 01015 const SbVec2f& getStartLocaterPosition() const { return startLocater; } 01016 01017 // The start locater position is automatically set when button 1 01018 // goes down over the dragger. Subclasses may wish to reset it, such 01019 // as when a constraint key goes down during dragging. 01020 void setStartLocaterPosition(const SbVec2f& p) { startLocater = p; } 01021 01022 // Has the locater moved far enough from where it started to 01023 // choose a constraint gesture. 01024 SbBool isAdequateConstraintMotion(); 01025 01026 // Given a pickPath and a surrogatePath, decides whether it should 01027 // grab based on the surrogate. First, the pickPath must 01028 // contain the surrogatePath, indicating that the surrogate was picked. 01029 // Second, we consider the part of the pickPath below the point where 01030 // the surrogatePath ends. 01031 // If this bottom section contains other draggers, then we will pass it up. 01032 // This is because the other draggers will want to grab when they find out 01033 // they've been picked. 01034 virtual SbBool shouldGrabBasedOnSurrogate( const SoPath *pickPath, 01035 const SoPath *surrogatePath ); 01036 01037 // 01038 // The dragger looks in this action to get information about the camera 01039 // and the viewport. Usually the action used is just the handleEventAction. 01040 void setCameraInfo( SoAction *action ); 01041 01042 // This is called during traversal by a HandleEventAction. It 01043 // calls ha->setHandled() if the event is handled. 01044 virtual void handleEvent(SoHandleEventAction *ha); 01045 01046 // This should be called by every child dragger of a compound dragger 01047 // as a result of compoundDragger->registerChildDragger( childDragger ); 01048 // Called on the compoundDragger when childDragger's value changes. 01049 // Gets the motionMatrix from a the child dragger. Appends that change 01050 // to the parent dragger's savedStartMatrix, and sets the result as the 01051 // parent's motionMatrix. 01052 // Then, it zeros out the motionMatrix of the child dragger. 01053 void transferMotion(SoDragger *child); 01054 01055 // Set/get whether the dragger should be ignored during bounding 01056 // box calculations. 01057 void setIgnoreInBbox( SbBool newVal ) { ignoreInBbox = newVal; } 01058 SbBool isIgnoreInBbox() { return ignoreInBbox; } 01059 01060 // Implements getBoundingBox action. Differs from separator as follows: 01061 // If the 'ignoreInBbox' flag is set to TRUE, then it will return without 01062 // traversing children. 01063 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 01064 01065 // Stubs used by compound draggers to get user callbacks from 01066 // the child dragger 01067 static void childTransferMotionAndValueChangedCB(void *, SoDragger *); 01068 static void childValueChangedCB(void *, SoDragger *); 01069 static void childStartCB(void *, SoDragger *); 01070 static void childMotionCB(void *, SoDragger *); 01071 static void childFinishCB(void *, SoDragger *); 01072 static void childOtherEventCB(void *, SoDragger *); 01073 01074 // Called by the above child callbacks. Establishes which child dragger 01075 // is currently active. Set at beginning of child callback, returned to 01076 // original value at end. Returns current value at time method is called. 01077 void setActiveChildDragger( SoDragger *newChildDragger ); 01078 SoDragger *getActiveChildDragger() const { return activeChildDragger; } 01079 01080 // Called by the SoBaseKit::write() method. 01081 // 01082 // Draggers don't want to write out fields if they have default vals. 01083 // 01084 // sets isActive to default if default and not connected. 01085 // 01086 // Looks for fields named: 01087 // 'rotation' with value SbRotation::identity() 01088 // 'translation' with value (0,0,0) 01089 // 'center' with value (0,0,0) 01090 // 'scaleFactor' with value (1,1,1) 01091 // and sets them to default if they are not connected from a field. 01092 // (most draggers are missing at least some of these, but thats okay) 01093 // 01094 // Then calls the method for SoInteractionKit. 01095 // 01096 // NOTE: Parts which are set to default may still wind up writing to file 01097 // if, for example, they lie on a path. 01098 virtual void setDefaultOnNonWritingFields(); 01099 01100 // In tracker direct mode, apply motion of tracked input device 01101 // directly to dragger's motion matrix. (new for v5.0) 01102 virtual SbBool applyTrackerMotion(); 01103 01104 virtual ~SoDragger(); 01105 01106 // Class static thread local storage 01107 struct MTstruct { 01108 SoGetMatrixAction *m_matrixAction; 01109 SoSearchAction *m_searchAction; 01110 }; 01111 01112 // Support for tracker direct mode (for immersive environments) 01113 // 01114 // Allows direct mode to be set for all draggers 01115 static TrackerDirectMode m_initialDirectMode; 01116 // Current direct mode for this dragger instance 01117 TrackerDirectMode m_directMode; 01118 // Default direct mode for this class of dragger 01119 TrackerDirectMode m_defaultDirectMode; 01120 // Saved start position of tracked input device 01121 SbVec3f m_trackerStartPos; 01122 // Saved start orientation of tracked input device 01123 SbRotation m_trackerStartRot; 01124 01125 SbViewVolume viewVolume; // view volume for xsection tests 01126 SbViewportRegion vpRegion; // view volume for xsection tests 01127 01128 private: 01129 01130 // lists of callback functions 01131 SoCallbackList *startCallbacks; 01132 SoCallbackList *motionCallbacks; 01133 SoCallbackList *finishCallbacks; 01134 SoCallbackList *valueChangedCallbacks; 01135 01136 SoCallbackList *otherEventCallbacks; 01137 01138 SbBool valueChangedCallbacksEnabled; 01139 SoDragger *activeChildDragger; 01140 01141 SoHandleEventAction *handleEventAction; // current event action 01142 01143 // A record of the world space point which initiated the dragging. 01144 // This might be set from a pickedPoint of a handleEventAction, 01145 // or explicitly from a given point when a meta-key callback 01146 // changes gestures mid-stream and wants to select its own transitional 01147 // starting point. 01148 SbVec3f startingWorldPoint; 01149 01150 // Used by parent draggers to save initial matrix when motion begins. 01151 SbMatrix startMotionMatrix; 01152 01153 // Where the locater was when dragging was initiated 01154 SbVec2f startLocater; 01155 01156 01157 // sets pick path and tempPathToThis 01158 void setPickPath(SoPath *newPickPath); 01159 SoPath *pickPath; // pick path to the dragger 01160 01161 // sets surrogate part picks. 01162 void setNoPickedSurrogate(); 01163 void setPickedSurrogate( SoPath *pathToOwner, SbName &nameUsedByOwner, 01164 SoPath *pathUsedByOwner ); 01165 01166 SbName surrogateNameInPickOwner; 01167 SoPath *pathToSurrogatePickOwner; 01168 SoPath *surrogatePathInPickOwner; 01169 01170 // A tempPath leading to 'this.' It is used to calculate the 01171 // motionMatrix. It is set when a dragger first grabs event, through the 01172 // handleEvent action, or by setCameraInfo() if NULL at the time. 01173 // A tempPath does not increase any ref counts, so keeping this path 01174 // will not prevent this node from being deleted. However, we must be 01175 // very careful before using it, since some nodes my get deleted out from 01176 // under us. The variable tempPathNumKidsHack helps us fix up paths 01177 // that have changed since the path was set. 01178 SoTempPath *tempPathToThis; 01179 SbPList *tempPathNumKidsHack; 01180 // Determines if this path can actually be used. Since a temp path 01181 // does not ref the nodes, some nodes my get deleted out from 01182 // under us. This routine makes sure that everythings all right. 01183 SbBool isTempPathToThisOk(); 01184 // Creates a temp path copy of the full path. 01185 SoTempPath *createTempPathFromFullPath( const SoFullPath *fp ) const; 01186 01187 // Minimum number of pixels to move before choosing a constraint 01188 // based on the gesture. 01189 float minGesture; 01190 01191 // The smallest scale that any dragger will write. If the user attempts 01192 // to go below this amount, the dragger will set it to this minimum. 01193 // Default is .0001 01194 static float minScale; 01195 01196 // We keep these matrices and their inverses around 01197 // to use when converting between spaces. The four 01198 // pairs are cached; the pair becomes invalud when its 01199 // valid flag is set to FALSE. 01200 01201 // Called to make sure these matrixes are up to date. 01202 void validateMatrices( SoAction* ); 01203 01204 // These matrices are ones that are commonly queried by 01205 // subclasses. So, we cache them. 01206 // Two things determine the localToWorld matrix. The pathToThis and 01207 // the motionMatrix. If either value is invalid, we need to recalculate. 01208 // But depending on which one it is, we either need to run a matrix 01209 // action on the pick path or just on the motionMatrix. 01210 SbBool cachedPathToThisValid; 01211 SbBool cachedMotionMatrixValid; 01212 SbMatrix cachedMotionMatrix; 01213 // PostMotion is the matrix space just AFTER the motion matrix. 01214 SbMatrix postMotionToWorldMatrix; 01215 SbMatrix worldToPostMotionMatrix; 01216 // PreMotion is the matrix space just BEFORE the motion matrix. 01217 SbMatrix preMotionToWorldMatrix; 01218 SbMatrix worldToPreMotionMatrix; 01219 01220 // Used so that draggers don't try to include themselves 01221 // as part of their own sizing boxes. By default this is FALSE. 01222 SbBool ignoreInBbox; 01223 01224 // True if we are interacting in order to update the SoInteractionElement 01225 bool m_draggerInteracting; 01226 01227 ProjectorFrontSetting projectorFrontSetting; 01228 }; 01229 01230 #endif /* _SO_DRAGGER_ */ 01231 01232