Open Inventor Reference
SoCenterballDragger.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27  * Mountain View, CA 94043, or:
28  *
29  * http://www.sgi.com
30  *
31  * For further information regarding this notice, see:
32  *
33  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34  *
35  */
36 
37 
38 /*
39  * Copyright (C) 1990,91 Silicon Graphics, Inc.
40  *
41  _______________________________________________________________________
42  ______________ S I L I C O N G R A P H I C S I N C . ____________
43  |
44  | $Revision: 1.1.1.1 $
45  |
46  | Description:
47  | This file defines a trackball-like dragger which allows the
48  | user to drag the center of rotation to a new location.
49  |
50  | NOTE TO DEVELOPERS:
51  | For info about the structure of SoCenterballDragger:
52  | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
53  | [2] type: ivNodeKitStructure SoCenterballDragger.
54  | [3] The program prints a diagram of the scene graph and a table with
55  | information about each part.
56  |
57  |
58  | The following parts in this dragger are created at construction time.
59  | 'ResourceName' corresponds to the name of the default geometry for the
60  | part. The dragger's constructor gets the scene graph for 'ResourceName'
61  | by querying the global dictionary ( SoDB::getByName("ResourceName"); ).
62  |
63  | Resource Name: Part Name:
64  |
65  | centerballRotator - rotator.rotator
66  | centerballRotatorActive - rotator.rotatorActive
67  |
68  | centerballStripe - XRotator.rotator
69  | centerballStripeActive - XRotator.rotatorActive
70  | centerballStripe - YRotator.rotator
71  | centerballStripeActive - YRotator.rotatorActive
72  | centerballStripe - ZRotator.rotator
73  | centerballStripeActive - ZRotator.rotatorActive
74  |
75  | centerballCenterChanger - XCenterChanger.translator
76  | centerballCenterChangerActive - XCenterChanger.translatorActive
77  | centerballCenterXAxisFeedback - XCenterChanger.xAxisFeedback
78  | centerballCenterYAxisFeedback - XCenterChanger.yAxisFeedback
79  |
80  | centerballCenterChanger - YCenterChanger.translator
81  | centerballCenterChangerActive - YCenterChanger.translatorActive
82  | centerballCenterXAxisFeedback - YCenterChanger.xAxisFeedback
83  | centerballCenterYAxisFeedback - YCenterChanger.yAxisFeedback
84  |
85  | centerballCenterChanger - ZCenterChanger.translator
86  | centerballCenterChangerActive - ZCenterChanger.translatorActive
87  | centerballCenterXAxisFeedback - ZCenterChanger.xAxisFeedback
88  | centerballCenterYAxisFeedback - ZCenterChanger.yAxisFeedback
89  |
90  | centerballXAxis - XAxis
91  | centerballYAxis - YAxis
92  | centerballZAxis - ZAxis
93  |
94  | Author(s): Paul Isaacs, Howard Look
95  |
96  ______________ S I L I C O N G R A P H I C S I N C . ____________
97  _______________________________________________________________________
98  */
99 
100 #ifndef _SO_CENTERBALL_DRAGGER_
101 #define _SO_CENTERBALL_DRAGGER_
102 
103 #include <Inventor/SbLinear.h>
108 
109 class SoFieldSensor;
110 class SoInput;
112 class SoGetMatrixAction;
113 
114 
117 
190 
192 
194 
196  SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
198  SO_KIT_CATALOG_ENTRY_HEADER(antiSquish);
199 
201  SO_KIT_CATALOG_ENTRY_HEADER(translateToCenter);
202 
203  SO_KIT_CATALOG_ENTRY_HEADER(lightModel);
204 
206 
207  SO_KIT_CATALOG_ENTRY_HEADER(YRotator);
208  SO_KIT_CATALOG_ENTRY_HEADER(ZCenterChanger);
209  SO_KIT_CATALOG_ENTRY_HEADER(ZAxisSwitch);
211 
213 
214  SO_KIT_CATALOG_ENTRY_HEADER(ZRotator);
215  SO_KIT_CATALOG_ENTRY_HEADER(YCenterChanger);
216  SO_KIT_CATALOG_ENTRY_HEADER(YAxisSwitch);
218 
220 
221  SO_KIT_CATALOG_ENTRY_HEADER(XRotator);
222 
224 
225  SO_KIT_CATALOG_ENTRY_HEADER(XCenterChanger);
226  SO_KIT_CATALOG_ENTRY_HEADER(XAxisSwitch);
228 
229  public:
232 
235 
236  SoEXTENDER public:
239  virtual void saveStartParameters();
240 
241  SoINTERNAL public:
242  static void initClass();
243 
244  protected:
245 
248  static void fieldSensorCB( void *, SoSensor *);
249  static void valueChangedCB( void *, SoDragger *);
250 
252 
259  virtual void getBoundingBox(SoGetBoundingBoxAction *action);
260  virtual void getMatrix(SoGetMatrixAction *action);
261 
262  static void kidStartCB( void *, SoDragger * );
263  static void kidFinishCB( void *, SoDragger * );
264 
265  void setSwitches( SoDragger *activeChild );
266 
275  virtual bool setUpConnections( bool onOff, bool doItAlways = FALSE );
276 
278 
280 
281  private:
282 
285  SbMatrix startCenterMatrix;
286 
288  static const unsigned char geomBuffer[];
289 };
290 
291 #endif /* _SO_CENTERBALL_DRAGGER_ */
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition: SbBasic.h:154
#define FALSE
Definition: SbBasic.h:79
#define SoINTERNAL
Definition: SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
#define SO_KIT_CATALOG_ENTRY_HEADER(partName)
This defines an SoSFNode field for the catalog part given.
Definition: SoSubKit.h:155
#define SO_KIT_HEADER(className)
Definition: SoSubKit.h:143
4x4 matrix class.
Definition: SbLinear.h:823
Striped ball you rotate and re-center by dragging with the mouse.
static void initClass()
initialize the class
virtual void setDefaultOnNonWritingFields()
Called by the SoBaseKit::write() method.
void transferCenterDraggerMotion(SoDragger *childDragger)
SoFieldSensor * rotFieldSensor
virtual void getMatrix(SoGetMatrixAction *action)
virtual bool setUpConnections(bool onOff, bool doItAlways=FALSE)
detach/attach any sensors, callbacks, and/or field connections.
static void kidStartCB(void *, SoDragger *)
void setSwitches(SoDragger *activeChild)
static void fieldSensorCB(void *, SoSensor *)
static void valueChangedCB(void *, SoDragger *)
SoFieldSensor * centerFieldSensor
static void kidFinishCB(void *, SoDragger *)
virtual void saveStartParameters()
Saves the matrix that moves the center relative to the motionMatrix after it calls the default SoDrag...
SoCenterballDragger()
Constructor.
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Differs from SoDragger as follows: If it has a surroundScale node with 'ignoreInBbox' set to TRUE,...
Base class for nodekits that move in response to click-drag-release mouse events.
Definition: SoDragger.h:225
Sensor class that can be attached to Inventor fields.
Definition: SoFieldSensor.h:80
Computes bounding box of a scene.
Computes transformation matrix for subgraph.
Used to read Inventor data files.
Definition: SoInput.h:128
Field containing a rotation.
Definition: SoSFRotation.h:84
Field containing a three-dimensional vector.
Definition: SoSFVec3f.h:79
Abstract base class for Inventor sensors.
Definition: SoSensor.h:108