Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/interaction/include/Inventor/draggers/SoScale2UniformDragger.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 two dimensional uniform scale dragger class.
00048  |      This is a simple dragger that allows an object to
00049  |      be scaled about a given center in a plane (defined by the
00050  |      center and a rotation. The rotation is a rotation which is to
00051  |      be applied to the default plane to define a new plane).
00052  |      The default plane has a normal of (0,0,1), and primary directions
00053  |      of (1,0,0) and (0,1,0)
00054  |
00055  |      The scaling occurs within the plane, but is a uniform scale in 
00056  |      both directions within that plane.
00057  |
00058  | NOTE TO DEVELOPERS:
00059  |     For info about the structure of SoScale2UniformDragger:
00060  |     [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
00061  |     [2] type:    ivNodeKitStructure SoScale2UniformDragger.
00062  |     [3] The program prints a diagram of the scene graph and a table with 
00063  |         information about each part.
00064  |
00065  |  The following parts in this dragger are created at construction time.
00066  |  'ResourceName' corresponds to the name of the default geometry for the
00067  |  part. The dragger's constructor gets the scene graph for 'ResourceName'
00068  |  by querying the global dictionary ( SoDB::getByName("ResourceName"); ).  
00069  |
00070  |  Resource Name:                           Part Name:
00071  |
00072  |  scale2UniformScaler                    - scaler
00073  |  scale2UniformScalerActive              - scalerActive
00074  |  scale2UniformFeedback                  - feedback
00075  |  scale2UniformFeedbackActive            - feedbackActive
00076  |
00077  |   Author(s): Paul Isaacs, Howard Look
00078  |
00079  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00080  _______________________________________________________________________
00081  */
00082 
00083 #ifndef  _SO_SCALE_2_UNIFORM_DRAGGER_
00084 #define  _SO_SCALE_2_UNIFORM_DRAGGER_
00085 
00086 #include <Inventor/SbLinear.h>
00087 #include <Inventor/draggers/SoDragger.h>
00088 #include <Inventor/fields/SoSFVec3f.h>
00089 #include <Inventor/sensors/SoSensor.h>
00090 
00091 class SbDict;
00092 class SbLineProjector;
00093 class SoFieldSensor;
00094 
00097 
00147 
00148 
00149 class INVENTOR_API SoScale2UniformDragger : public SoDragger
00150 {
00151     SO_KIT_HEADER(SoScale2UniformDragger);
00152 
00153     SO_KIT_CATALOG_ENTRY_HEADER(scalerSwitch);
00154     SO_KIT_CATALOG_ENTRY_HEADER(scaler);
00155     SO_KIT_CATALOG_ENTRY_HEADER(scalerActive);
00156     SO_KIT_CATALOG_ENTRY_HEADER(feedbackSwitch);
00157     SO_KIT_CATALOG_ENTRY_HEADER(feedback);
00158     SO_KIT_CATALOG_ENTRY_HEADER(feedbackActive);
00159 
00160   public:
00161 
00163     SoScale2UniformDragger();
00164 
00165     SoSFVec3f scaleFactor;
00166 
00167   SoINTERNAL public:
00168     static void initClass();  
00169 
00170   protected:
00171 
00172     SbVec3f           closestPtOfZeroScale; 
00173     SbLineProjector   *lineProj;     
00174 
00175     static void startCB( void *, SoDragger * );
00176     static void motionCB( void *, SoDragger * );
00177     static void finishCB( void *, SoDragger * );
00178 
00179     SoFieldSensor *fieldSensor;
00180     static void fieldSensorCB( void *, SoSensor * );
00181     static void valueChangedCB( void *, SoDragger * );
00182 
00183     void dragStart();
00184     void drag();
00185     void dragFinish();
00186 
00193     virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
00194 
00195     virtual ~SoScale2UniformDragger();
00196 
00197   private:
00198     static const char geomBuffer[];
00199 };    
00200 
00201 #endif  /* _SO_SCALE_2_UNIFORM_DRAGGER_ */
00202 
00203 
00204