Open Inventor Reference
SoScaleUniformDragger.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 uniform scale dragger class.
48  | This is a simple dragger that allows an object to
49  | be scaled uniformly based on some given scaleCenter, and
50  | a line from that scaleCenter to the point on the object that was
51  | picked.
52  |
53  | The mouse position is projected on to the closest
54  | point on that line, and the change in distance along
55  | that line is used to determine the scale factor.
56  |
57  | NOTE TO DEVELOPERS:
58  | For info about the structure of SoScaleUniformDragger:
59  | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
60  | [2] type: ivNodeKitStructure SoScaleUniformDragger.
61  | [3] The program prints a diagram of the scene graph and a table with
62  | information about each part.
63  |
64  | The following parts in this dragger are created at construction time.
65  | 'ResourceName' corresponds to the name of the default geometry for the
66  | part. The dragger's constructor gets the scene graph for 'ResourceName'
67  | by querying the global dictionary ( SoDB::getByName("ResourceName"); ).
68  |
69  | Resource Name: Part Name:
70  |
71  | scaleUniformScaler - scaler
72  | scaleUniformScalerActive - scalerActive
73  | scaleUniformFeedback - feedback
74  | scaleUniformFeedbackActive - feedbackActive
75  |
76  | Author(s): Paul Isaacs, Howard Look
77  |
78  ______________ S I L I C O N G R A P H I C S I N C . ____________
79  _______________________________________________________________________
80  */
81 
82 #ifndef _SO_SCALE_UNIFORM_DRAGGER_
83 #define _SO_SCALE_UNIFORM_DRAGGER_
84 
85 #include <Inventor/SbLinear.h>
89 
90 class SbDict;
91 class SbLineProjector;
92 class SoFieldSensor;
93 
96 
150 
152 {
154 
155  SO_KIT_CATALOG_ENTRY_HEADER(scalerSwitch);
157  SO_KIT_CATALOG_ENTRY_HEADER(scalerActive);
158  SO_KIT_CATALOG_ENTRY_HEADER(feedbackSwitch);
159  SO_KIT_CATALOG_ENTRY_HEADER(feedback);
160  SO_KIT_CATALOG_ENTRY_HEADER(feedbackActive);
161 
162  public:
163 
166 
168 
169  SoINTERNAL public:
170  static void initClass();
171 
172  protected:
173 
175 
176  static void startCB( void *, SoDragger * );
177  static void motionCB( void *, SoDragger * );
178  static void finishCB( void *, SoDragger * );
179 
181  static void fieldSensorCB( void *, SoSensor * );
182  static void valueChangedCB( void *, SoDragger * );
183 
184  void dragStart();
185  void drag();
186  void dragFinish();
187 
194  virtual bool setUpConnections( bool onOff, bool doItAlways = FALSE );
195 
197 
198  private:
199  static const unsigned char geomBuffer[];
200 };
201 
202 #endif /* _SO_SCALE_UNIFORM_DRAGGER_ */
203 
204 
205 
#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
This is a dictionary mapping (size_t) integer keys to (void *) data pointers.
Definition: SbDict.h:101
Line projector.
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
Field containing a three-dimensional vector.
Definition: SoSFVec3f.h:79
Object you can scale uniformly in 3D by dragging with the mouse.
SbLineProjector * lineProj
projector for linear scaling
virtual ~SoScaleUniformDragger()
static void startCB(void *, SoDragger *)
static void initClass()
initialize the class
static void valueChangedCB(void *, SoDragger *)
static void fieldSensorCB(void *, SoSensor *)
virtual bool setUpConnections(bool onOff, bool doItAlways=FALSE)
detach/attach any sensors, callbacks, and/or field connections.
static void finishCB(void *, SoDragger *)
SoScaleUniformDragger()
Constructors.
static void motionCB(void *, SoDragger *)
Abstract base class for Inventor sensors.
Definition: SoSensor.h:108