Open Inventor Reference
|
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 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 amount moved in the plane determines the amount of scale. 00056 | 00057 | NOTE TO DEVELOPERS: 00058 | For info about the structure of SoScale2Dragger: 00059 | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure 00060 | [2] type: ivNodeKitStructure SoScale2Dragger. 00061 | [3] The program prints a diagram of the scene graph and a table with 00062 | information about each part. 00063 | 00064 | The following parts in this dragger are created at construction time. 00065 | 'ResourceName' corresponds to the name of the default geometry for the 00066 | part. The dragger's constructor gets the scene graph for 'ResourceName' 00067 | by querying the global dictionary ( SoDB::getByName("ResourceName"); ). 00068 | 00069 | Resource Name: Part Name: 00070 | 00071 | scale2Scaler - scaler 00072 | scale2ScalerActive - scalerActive 00073 | scale2Feedback - feedback 00074 | scale2FeedbackActive - feedbackActive 00075 | 00076 | Author(s): Paul Isaacs, Howard Look 00077 | 00078 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00079 _______________________________________________________________________ 00080 */ 00081 00082 #ifndef _SO_SCALE_2_DRAGGER_ 00083 #define _SO_SCALE_2_DRAGGER_ 00084 00085 #include <Inventor/SbLinear.h> 00086 #include <Inventor/draggers/SoDragger.h> 00087 #include <Inventor/fields/SoSFVec3f.h> 00088 #include <Inventor/sensors/SoSensor.h> 00089 00090 class SbDict; 00091 class SbPlaneProjector; 00092 class SoFieldSensor; 00093 00096 00150 00151 00152 class INVENTOR_API SoScale2Dragger : public SoDragger 00153 { 00154 SO_KIT_HEADER(SoScale2Dragger); 00155 00156 SO_KIT_CATALOG_ENTRY_HEADER(scalerSwitch); 00157 SO_KIT_CATALOG_ENTRY_HEADER(scaler); 00158 SO_KIT_CATALOG_ENTRY_HEADER(scalerActive); 00159 SO_KIT_CATALOG_ENTRY_HEADER(feedbackSwitch); 00160 SO_KIT_CATALOG_ENTRY_HEADER(feedback); 00161 SO_KIT_CATALOG_ENTRY_HEADER(feedbackActive); 00162 00163 public: 00164 00166 SoScale2Dragger(); 00167 00168 SoSFVec3f scaleFactor; 00169 00170 SoINTERNAL public: 00171 static void initClass(); 00172 00173 protected: 00174 00175 SbPlaneProjector *planeProj; 00176 00177 static void startCB( void *, SoDragger * ); 00178 static void motionCB( void *, SoDragger * ); 00179 static void finishCB( void *, SoDragger * ); 00180 00181 SoFieldSensor *fieldSensor; 00182 static void fieldSensorCB( void *, SoSensor * ); 00183 static void valueChangedCB( void *, SoDragger * ); 00184 00185 void dragStart(); 00186 void drag(); 00187 void dragFinish(); 00188 00195 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE ); 00196 00197 virtual ~SoScale2Dragger(); 00198 00199 private: 00200 static const char geomBuffer[]; 00201 }; 00202 00203 #endif /* _SO_SCALE_2_DRAGGER_ */ 00204 00205 00206