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 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 a trackball-like dragger which allows the 00048 | user to drag the center of rotation to a new location. 00049 | 00050 | NOTE TO DEVELOPERS: 00051 | For info about the structure of SoCenterballDragger: 00052 | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure 00053 | [2] type: ivNodeKitStructure SoCenterballDragger. 00054 | [3] The program prints a diagram of the scene graph and a table with 00055 | information about each part. 00056 | 00057 | 00058 | The following parts in this dragger are created at construction time. 00059 | 'ResourceName' corresponds to the name of the default geometry for the 00060 | part. The dragger's constructor gets the scene graph for 'ResourceName' 00061 | by querying the global dictionary ( SoDB::getByName("ResourceName"); ). 00062 | 00063 | Resource Name: Part Name: 00064 | 00065 | centerballRotator - rotator.rotator 00066 | centerballRotatorActive - rotator.rotatorActive 00067 | 00068 | centerballStripe - XRotator.rotator 00069 | centerballStripeActive - XRotator.rotatorActive 00070 | centerballStripe - YRotator.rotator 00071 | centerballStripeActive - YRotator.rotatorActive 00072 | centerballStripe - ZRotator.rotator 00073 | centerballStripeActive - ZRotator.rotatorActive 00074 | 00075 | centerballCenterChanger - XCenterChanger.translator 00076 | centerballCenterChangerActive - XCenterChanger.translatorActive 00077 | centerballCenterXAxisFeedback - XCenterChanger.xAxisFeedback 00078 | centerballCenterYAxisFeedback - XCenterChanger.yAxisFeedback 00079 | 00080 | centerballCenterChanger - YCenterChanger.translator 00081 | centerballCenterChangerActive - YCenterChanger.translatorActive 00082 | centerballCenterXAxisFeedback - YCenterChanger.xAxisFeedback 00083 | centerballCenterYAxisFeedback - YCenterChanger.yAxisFeedback 00084 | 00085 | centerballCenterChanger - ZCenterChanger.translator 00086 | centerballCenterChangerActive - ZCenterChanger.translatorActive 00087 | centerballCenterXAxisFeedback - ZCenterChanger.xAxisFeedback 00088 | centerballCenterYAxisFeedback - ZCenterChanger.yAxisFeedback 00089 | 00090 | centerballXAxis - XAxis 00091 | centerballYAxis - YAxis 00092 | centerballZAxis - ZAxis 00093 | 00094 | Author(s): Paul Isaacs, Howard Look 00095 | 00096 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00097 _______________________________________________________________________ 00098 */ 00099 00100 #ifndef _SO_CENTERBALL_DRAGGER_ 00101 #define _SO_CENTERBALL_DRAGGER_ 00102 00103 #include <Inventor/SbLinear.h> 00104 #include <Inventor/sensors/SoSensor.h> 00105 #include <Inventor/draggers/SoDragger.h> 00106 #include <Inventor/fields/SoSFVec3f.h> 00107 #include <Inventor/fields/SoSFRotation.h> 00108 00109 class SoFieldSensor; 00110 class SoInput; 00111 class SoGetBoundingBoxAction; 00112 class SoGetMatrixAction; 00113 00114 00117 00189 00190 00191 class INVENTOR_API SoCenterballDragger : public SoDragger { 00192 00193 SO_KIT_HEADER(SoCenterballDragger); 00194 00196 SO_KIT_CATALOG_ENTRY_HEADER(surroundScale); 00198 SO_KIT_CATALOG_ENTRY_HEADER(antiSquish); 00199 00201 SO_KIT_CATALOG_ENTRY_HEADER(translateToCenter); 00202 00203 SO_KIT_CATALOG_ENTRY_HEADER(lightModel); 00204 00205 SO_KIT_CATALOG_ENTRY_HEADER(rotator); 00206 00207 SO_KIT_CATALOG_ENTRY_HEADER(YRotator); 00208 SO_KIT_CATALOG_ENTRY_HEADER(ZCenterChanger); 00209 SO_KIT_CATALOG_ENTRY_HEADER(ZAxisSwitch); 00210 SO_KIT_CATALOG_ENTRY_HEADER(ZAxis); 00211 00212 SO_KIT_CATALOG_ENTRY_HEADER(rotX90); 00213 00214 SO_KIT_CATALOG_ENTRY_HEADER(ZRotator); 00215 SO_KIT_CATALOG_ENTRY_HEADER(YCenterChanger); 00216 SO_KIT_CATALOG_ENTRY_HEADER(YAxisSwitch); 00217 SO_KIT_CATALOG_ENTRY_HEADER(YAxis); 00218 00219 SO_KIT_CATALOG_ENTRY_HEADER(rotY90); 00220 00221 SO_KIT_CATALOG_ENTRY_HEADER(XRotator); 00222 00223 SO_KIT_CATALOG_ENTRY_HEADER(rot2X90); 00224 00225 SO_KIT_CATALOG_ENTRY_HEADER(XCenterChanger); 00226 SO_KIT_CATALOG_ENTRY_HEADER(XAxisSwitch); 00227 SO_KIT_CATALOG_ENTRY_HEADER(XAxis); 00228 00229 public: 00231 SoCenterballDragger(); 00232 00233 SoSFRotation rotation; 00234 SoSFVec3f center; 00235 00236 SoEXTENDER public: 00239 virtual void saveStartParameters(); 00240 00241 SoINTERNAL public: 00242 static void initClass(); 00243 00244 protected: 00245 00246 SoFieldSensor *rotFieldSensor; 00247 SoFieldSensor *centerFieldSensor; 00248 static void fieldSensorCB( void *, SoSensor *); 00249 static void valueChangedCB( void *, SoDragger *); 00250 00251 void transferCenterDraggerMotion(SoDragger *childDragger); 00252 00259 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00260 virtual void getMatrix(SoGetMatrixAction *action); 00261 00262 static void kidStartCB( void *, SoDragger * ); 00263 static void kidFinishCB( void *, SoDragger * ); 00264 00265 void setSwitches( SoDragger *activeChild ); 00266 00275 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE ); 00276 00277 virtual void setDefaultOnNonWritingFields(); 00278 00279 ~SoCenterballDragger(); 00280 00281 private: 00282 00285 SbMatrix startCenterMatrix; 00286 00288 static const char geomBuffer[]; 00289 }; 00290 00291 #endif /* _SO_CENTERBALL_DRAGGER_ */