Open Inventor Reference
SoRotateCylindricalDragger.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,92 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 the Rotate Cylindrical dragger class.
48  | This is a simple dragger that returns a rotation
49  | based on vectors from the axis of the cylinder to its surface.
50  |
51  | The mouse position is projected onto a cylinder determined
52  | by the axis and the radius. The radius is determined by the
53  | distance from the axis to the initial hit point.
54  |
55  | NOTE TO DEVELOPERS:
56  | For info about the structure of SoRotateCylindricalDragger:
57  | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
58  | [2] type: ivNodeKitStructure SoRotateCylindricalDragger.
59  | [3] The program prints a diagram of the scene graph and a table with
60  | information about each part.
61  |
62  | The following parts in this dragger are created at construction time.
63  | 'ResourceName' corresponds to the name of the default geometry for the
64  | part. The dragger's constructor gets the scene graph for 'ResourceName'
65  | by querying the global dictionary ( SoDB::getByName("ResourceName"); ).
66  |
67  | Resource Name: Part Name:
68  |
69  | rotateCylindricalRotator - rotator
70  | rotateCylindricalRotatorActive - rotatorActive
71  | rotateCylindricalFeedback - feedback
72  | rotateCylindricalFeedbackActive - feedbackActive
73  |
74  | Author(s): Paul Isaacs, Howard Look
75  |
76  ______________ S I L I C O N G R A P H I C S I N C . ____________
77  _______________________________________________________________________
78  */
79 
80 #ifndef _SO_ROTATE_CYLINDRICAL_DRAGGER_
81 #define _SO_ROTATE_CYLINDRICAL_DRAGGER_
82 
83 #include <Inventor/SbLinear.h>
87 
88 class SbDict;
90 class SoFieldSensor;
91 
94 
145 
147 {
149 
150  SO_KIT_CATALOG_ENTRY_HEADER(rotatorSwitch);
152  SO_KIT_CATALOG_ENTRY_HEADER(rotatorActive);
153  SO_KIT_CATALOG_ENTRY_HEADER(feedbackSwitch);
154  SO_KIT_CATALOG_ENTRY_HEADER(feedback);
155  SO_KIT_CATALOG_ENTRY_HEADER(feedbackActive);
156 
157  public:
158 
161 
163 
177  const SbCylinderProjector * getProjector() const { return cylinderProj;}
178 
179  SoINTERNAL public:
180  static void initClass();
181 
182  protected:
183 
185  bool userProj;
186 
189  virtual void copyContents(const SoFieldContainer *fromFC,
190  bool copyConnections);
191 
192  static void startCB( void *, SoDragger * );
193  static void motionCB( void *, SoDragger * );
194  static void doneCB( void *, SoDragger * );
195 
197  static void fieldSensorCB( void *, SoSensor * );
198  static void valueChangedCB( void *, SoDragger * );
199 
200  void dragStart();
201  void drag();
202  void dragFinish();
203 
210  virtual bool setUpConnections( bool onOff, bool doItAlways = FALSE );
211 
212 
214 
215  private:
216  static const unsigned char geomBuffer[];
217 };
218 
219 
220 
221 #endif /* _SO_ROTATE_CYLINDRICAL_DRAGGER_ */
222 
223 
#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
Cylinder projector.
This is a dictionary mapping (size_t) integer keys to (void *) data pointers.
Definition: SbDict.h:101
Base class for nodekits that move in response to click-drag-release mouse events.
Definition: SoDragger.h:225
Abstract base class for objects that contain fields.
Sensor class that can be attached to Inventor fields.
Definition: SoFieldSensor.h:80
Object you rotate along a cylindrical surface by dragging with the mouse.
bool userProj
using a user defined projector?
virtual ~SoRotateCylindricalDragger()
static void valueChangedCB(void *, SoDragger *)
static void initClass()
initialize the class
virtual void copyContents(const SoFieldContainer *fromFC, bool copyConnections)
Redefines this to also copy the projector.
static void fieldSensorCB(void *, SoSensor *)
static void startCB(void *, SoDragger *)
void setProjector(SbCylinderProjector *p)
Set a different cylinder projector.
virtual bool setUpConnections(bool onOff, bool doItAlways=FALSE)
detach/attach any sensors, callbacks, and/or field connections.
SoRotateCylindricalDragger()
Constructor.
static void motionCB(void *, SoDragger *)
SbCylinderProjector * cylinderProj
Cylinder projector to use.
const SbCylinderProjector * getProjector() const
Get cylinder projector.
static void doneCB(void *, SoDragger *)
Field containing a rotation.
Definition: SoSFRotation.h:84
Abstract base class for Inventor sensors.
Definition: SoSensor.h:108