Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/interaction/include/Inventor/draggers/SoRotateCylindricalDragger.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,92   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 Rotate Cylindrical dragger class.
00048  |      This is a simple dragger that returns a rotation
00049  |      based on vectors from the axis of the cylinder to its surface.
00050  |
00051  |      The mouse position is projected onto a cylinder determined
00052  |      by the axis and the radius. The radius is determined by the
00053  |      distance from the axis to the initial hit point.
00054  |
00055  | NOTE TO DEVELOPERS:
00056  |     For info about the structure of SoRotateCylindricalDragger:
00057  |     [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
00058  |     [2] type:    ivNodeKitStructure SoRotateCylindricalDragger.
00059  |     [3] The program prints a diagram of the scene graph and a table with 
00060  |         information about each part.
00061  |
00062  |  The following parts in this dragger are created at construction time.
00063  |  'ResourceName' corresponds to the name of the default geometry for the
00064  |  part. The dragger's constructor gets the scene graph for 'ResourceName'
00065  |  by querying the global dictionary ( SoDB::getByName("ResourceName"); ).  
00066  |
00067  |  Resource Name:                           Part Name:
00068  |
00069  |  rotateCylindricalRotator               - rotator
00070  |  rotateCylindricalRotatorActive         - rotatorActive
00071  |  rotateCylindricalFeedback              - feedback
00072  |  rotateCylindricalFeedbackActive        - feedbackActive
00073  |
00074  |   Author(s): Paul Isaacs, Howard Look
00075  |
00076  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00077  _______________________________________________________________________
00078  */
00079 
00080 #ifndef  _SO_ROTATE_CYLINDRICAL_DRAGGER_
00081 #define  _SO_ROTATE_CYLINDRICAL_DRAGGER_
00082 
00083 #include <Inventor/SbLinear.h>
00084 #include <Inventor/draggers/SoDragger.h>
00085 #include <Inventor/fields/SoSFRotation.h>
00086 #include <Inventor/sensors/SoSensor.h>
00087 
00088 class SbDict;
00089 class SbCylinderProjector;
00090 class SoFieldSensor;
00091 
00094 
00144 
00145 
00146 class INVENTOR_API SoRotateCylindricalDragger : public SoDragger
00147 {
00148     SO_KIT_HEADER(SoRotateCylindricalDragger);
00149 
00150     SO_KIT_CATALOG_ENTRY_HEADER(rotatorSwitch);
00151     SO_KIT_CATALOG_ENTRY_HEADER(rotator);
00152     SO_KIT_CATALOG_ENTRY_HEADER(rotatorActive);
00153     SO_KIT_CATALOG_ENTRY_HEADER(feedbackSwitch);
00154     SO_KIT_CATALOG_ENTRY_HEADER(feedback);
00155     SO_KIT_CATALOG_ENTRY_HEADER(feedbackActive);
00156 
00157   public:
00158 
00160     SoRotateCylindricalDragger();
00161     
00162     SoSFRotation rotation;
00163 
00175     void                        setProjector(SbCylinderProjector *p);
00177     const SbCylinderProjector * getProjector() const    { return cylinderProj;}
00178 
00179   SoINTERNAL public:
00180     static void         initClass();    
00181 
00182   protected:
00183 
00184     SbCylinderProjector *cylinderProj;   
00185     SbBool              userProj;        
00186 
00189     virtual void        copyContents(const SoFieldContainer *fromFC,
00190                                      SbBool copyConnections);
00191 
00192     static void startCB( void *, SoDragger * );
00193     static void motionCB( void *, SoDragger * );
00194     static void doneCB( void *, SoDragger * );
00195 
00196     SoFieldSensor *fieldSensor;
00197     static void fieldSensorCB( void *, SoSensor * );
00198     static void valueChangedCB( void *, SoDragger * );
00199 
00200     void        dragStart();
00201     void        drag();
00202     void        dragFinish();
00203 
00210     virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
00211 
00212     
00213     virtual ~SoRotateCylindricalDragger();
00214 
00215   private:
00216     static const char geomBuffer[];
00217 };    
00218 
00219 
00220 
00221 #endif  /* _SO_ROTATE_CYLINDRICAL_DRAGGER_ */
00222 
00223