Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/interaction/include/Inventor/draggers/SoDragPointDragger.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  Copyright (C) 2000 Silicon Graphics, Inc.  All Rights Reserved. 
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  Further, this software is distributed without any warranty that it is
00016  *  free of the rightful claim of any third person regarding infringement
00017  *  or the like.  Any license provided herein, whether implied or
00018  *  otherwise, applies only to this software file.  Patent licenses, if
00019  *  any, provided herein do not apply to combinations of this program with
00020  *  other software, or any other product whatsoever.
00021  * 
00022  *  You should have received a copy of the GNU Lesser General Public
00023  *  License along with this library; if not, write to the Free Software
00024  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  *  Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
00027  *  Mountain View, CA  94043, or:
00028  * 
00029  *  http://www.sgi.com 
00030  * 
00031  *  For further information regarding this notice, see: 
00032  * 
00033  *  http://oss.sgi.com/projects/GenInfo/NoticeExplan/
00034  *
00035  */
00036 
00037 
00038 /*
00039  * Copyright (C) 1990,91   Silicon Graphics, Inc.
00040  *
00041  _______________________________________________________________________
00042  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00043  |
00044  |   $Revision: 1.1.1.1 $
00045  |
00046  |   Description:
00047  |      This file defines the drag point dragger class.
00048  |
00049  | NOTE TO DEVELOPERS:
00050  |     For info about the structure of SoDragPointDragger:
00051  |     [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
00052  |     [2] type:    ivNodeKitStructure SoDragPointDragger.
00053  |     [3] The program prints a diagram of the scene graph and a table with 
00054  |         information about each part.
00055  |
00056  |  The following parts in this dragger are created at construction time.
00057  |  'ResourceName' corresponds to the name of the default geometry for the
00058  |  part. The dragger's constructor gets the scene graph for 'ResourceName'
00059  |  by querying the global dictionary ( SoDB::getByName("ResourceName"); ).  
00060  |
00061  |  Resource Name:                           Part Name:
00062  |
00063  |  dragPointXTranslatorTranslator        - xTranslator.translator
00064  |  dragPointXTranslatorTranslatorActive  - xTranslator.translatorActive
00065  |  dragPointYTranslatorTranslator        - yTranslator.translator
00066  |  dragPointYTranslatorTranslatorActive  - yTranslator.translatorActive
00067  |  dragPointZTranslatorTranslator        - zTranslator.translator
00068  |  dragPointZTranslatorTranslatorActive  - zTranslator.translatorActive
00069  |
00070  |  dragPointYZTranslatorTranslator       - yzTranslator.translator
00071  |  dragPointYZTranslatorTranslatorActive - yzTranslator.translatorActive
00072  |  dragPointXZTranslatorTranslator       - xzTranslator.translator
00073  |  dragPointXZTranslatorTranslatorActive - xzTranslator.translatorActive
00074  |  dragPointXYTranslatorTranslator       - xyTranslator.translator
00075  |  dragPointXYTranslatorTranslatorActive - xyTranslator.translatorActive
00076  |
00077  |  dragPointXFeedback                    - xFeedback
00078  |  dragPointYFeedback                    - yFeedback
00079  |  dragPointZFeedback                    - zFeedback
00080  |
00081  |  dragPointYZFeedback                   - yzFeedback
00082  |  dragPointXZFeedback                   - xzFeedback
00083  |  dragPointXYFeedback                   - xyFeedback
00084  |
00085  |   Author(s): Paul Isaacs, Howard Look
00086  |
00087  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00088  _______________________________________________________________________
00089  */
00090 
00091 #ifndef  _SO_DRAGPOINT_DRAGGER_
00092 #define  _SO_DRAGPOINT_DRAGGER_
00093 
00094 #include <Inventor/SbLinear.h>
00095 #include <Inventor/SbBox.h>
00096 #include <Inventor/draggers/SoDragger.h>
00097 #include <Inventor/fields/SoSFVec3f.h>
00098 #include <Inventor/sensors/SoSensor.h>
00099 
00100 
00101 class SoFieldSensor;
00102 
00103 
00106 
00193 
00194 
00195 class INVENTOR_API SoDragPointDragger : public SoDragger
00196 {
00197     SO_KIT_HEADER(SoDragPointDragger);
00198 
00199     SO_KIT_CATALOG_ENTRY_HEADER(noRotSep);
00200     SO_KIT_CATALOG_ENTRY_HEADER(xTranslatorSwitch);
00201     SO_KIT_CATALOG_ENTRY_HEADER(xTranslator);
00202     SO_KIT_CATALOG_ENTRY_HEADER(xyTranslatorSwitch);
00203     SO_KIT_CATALOG_ENTRY_HEADER(xyTranslator);
00204 
00205     SO_KIT_CATALOG_ENTRY_HEADER(rotXSep);
00206     SO_KIT_CATALOG_ENTRY_HEADER(rotX);
00207     SO_KIT_CATALOG_ENTRY_HEADER(xzTranslatorSwitch);
00208     SO_KIT_CATALOG_ENTRY_HEADER(xzTranslator);
00209 
00210     SO_KIT_CATALOG_ENTRY_HEADER(rotYSep);
00211     SO_KIT_CATALOG_ENTRY_HEADER(rotY);
00212     SO_KIT_CATALOG_ENTRY_HEADER(zTranslatorSwitch);
00213     SO_KIT_CATALOG_ENTRY_HEADER(zTranslator);
00214     SO_KIT_CATALOG_ENTRY_HEADER(yzTranslatorSwitch);
00215     SO_KIT_CATALOG_ENTRY_HEADER(yzTranslator);
00216 
00217     SO_KIT_CATALOG_ENTRY_HEADER(rotZSep);
00218     SO_KIT_CATALOG_ENTRY_HEADER(rotZ);
00219     SO_KIT_CATALOG_ENTRY_HEADER(yTranslatorSwitch);
00220     SO_KIT_CATALOG_ENTRY_HEADER(yTranslator);
00221 
00222     SO_KIT_CATALOG_ENTRY_HEADER(xFeedbackSwitch);
00223     SO_KIT_CATALOG_ENTRY_HEADER(xFeedbackSep);
00224     SO_KIT_CATALOG_ENTRY_HEADER(xFeedbackTranslation);
00225     SO_KIT_CATALOG_ENTRY_HEADER(xFeedback);
00226 
00227     SO_KIT_CATALOG_ENTRY_HEADER(yFeedbackSwitch);
00228     SO_KIT_CATALOG_ENTRY_HEADER(yFeedbackSep);
00229     SO_KIT_CATALOG_ENTRY_HEADER(yFeedbackTranslation);
00230     SO_KIT_CATALOG_ENTRY_HEADER(yFeedback);
00231 
00232     SO_KIT_CATALOG_ENTRY_HEADER(zFeedbackSwitch);
00233     SO_KIT_CATALOG_ENTRY_HEADER(zFeedbackSep);
00234     SO_KIT_CATALOG_ENTRY_HEADER(zFeedbackTranslation);
00235     SO_KIT_CATALOG_ENTRY_HEADER(zFeedback);
00236 
00237     SO_KIT_CATALOG_ENTRY_HEADER(planeFeedbackSep);
00238     SO_KIT_CATALOG_ENTRY_HEADER(planeFeedbackTranslation);
00239     SO_KIT_CATALOG_ENTRY_HEADER(planeFeedbackSwitch);
00240     SO_KIT_CATALOG_ENTRY_HEADER(yzFeedback);
00241     SO_KIT_CATALOG_ENTRY_HEADER(xzFeedback);
00242     SO_KIT_CATALOG_ENTRY_HEADER(xyFeedback);
00243 
00244   public:
00245 
00247     SoDragPointDragger();
00248 
00249     SoSFVec3f translation;
00250 
00251   public:
00252 
00257     void    setJumpLimit(float limit)   { jumpLimit = limit; }
00260     float   getJumpLimit() const        { return jumpLimit; }
00261 
00267     void showNextDraggerSet();
00268 
00269   SoINTERNAL public:
00270     static void         initClass();    
00271 
00272   protected:
00273 
00274     static void startCB( void *, SoDragger * );
00275     static void motionCB( void *, SoDragger * );
00276     static void finishCB( void *, SoDragger * );
00277 
00278     SoFieldSensor *fieldSensor;
00279     static void fieldSensorCB( void *, SoSensor * );
00280     static void valueChangedCB( void *, SoDragger * );
00281 
00282     static void metaKeyChangeCB( void *, SoDragger *);
00283 
00284     void        dragStart();
00285     void        drag();
00286     void        dragFinish();
00287     
00296     virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
00297 
00298     virtual void setDefaultOnNonWritingFields();
00299 
00300     virtual ~SoDragPointDragger();
00301 
00302   private:
00303     
00304     SoDragger *currentDragger;
00305     SbVec3f    startLocalHitPt;
00306 
00307     SbBool          shftDown;  
00308 
00313     SbBox3f     limitBox;
00314     
00316     float       jumpLimit;
00317 
00320     void        setFeedbackGeometry();
00321 
00323     void        checkBoxLimits();
00324 
00326     void  updateLimitBoxAndFeedback();
00327 
00328     static const char geomBuffer[];
00329 
00331     SoNode *oldXAxisNode;
00332     SoNode *oldYAxisNode;
00333     SoNode *oldZAxisNode;
00334 };
00335 
00336 #endif  /* _SO_DRAGPOINT_DRAGGER_ */