Open Inventor Reference
SoDragPointDragger.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 the drag point dragger class.
48  |
49  | NOTE TO DEVELOPERS:
50  | For info about the structure of SoDragPointDragger:
51  | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
52  | [2] type: ivNodeKitStructure SoDragPointDragger.
53  | [3] The program prints a diagram of the scene graph and a table with
54  | information about each part.
55  |
56  | The following parts in this dragger are created at construction time.
57  | 'ResourceName' corresponds to the name of the default geometry for the
58  | part. The dragger's constructor gets the scene graph for 'ResourceName'
59  | by querying the global dictionary ( SoDB::getByName("ResourceName"); ).
60  |
61  | Resource Name: Part Name:
62  |
63  | dragPointXTranslatorTranslator - xTranslator.translator
64  | dragPointXTranslatorTranslatorActive - xTranslator.translatorActive
65  | dragPointYTranslatorTranslator - yTranslator.translator
66  | dragPointYTranslatorTranslatorActive - yTranslator.translatorActive
67  | dragPointZTranslatorTranslator - zTranslator.translator
68  | dragPointZTranslatorTranslatorActive - zTranslator.translatorActive
69  |
70  | dragPointYZTranslatorTranslator - yzTranslator.translator
71  | dragPointYZTranslatorTranslatorActive - yzTranslator.translatorActive
72  | dragPointXZTranslatorTranslator - xzTranslator.translator
73  | dragPointXZTranslatorTranslatorActive - xzTranslator.translatorActive
74  | dragPointXYTranslatorTranslator - xyTranslator.translator
75  | dragPointXYTranslatorTranslatorActive - xyTranslator.translatorActive
76  |
77  | dragPointXFeedback - xFeedback
78  | dragPointYFeedback - yFeedback
79  | dragPointZFeedback - zFeedback
80  |
81  | dragPointYZFeedback - yzFeedback
82  | dragPointXZFeedback - xzFeedback
83  | dragPointXYFeedback - xyFeedback
84  |
85  | Author(s): Paul Isaacs, Howard Look
86  |
87  ______________ S I L I C O N G R A P H I C S I N C . ____________
88  _______________________________________________________________________
89  */
90 
91 #ifndef _SO_DRAGPOINT_DRAGGER_
92 #define _SO_DRAGPOINT_DRAGGER_
93 
94 #include <Inventor/SbLinear.h>
95 #include <Inventor/SbBox.h>
99 
100 
101 class SoFieldSensor;
102 
103 
106 
194 
196 {
198 
199  SO_KIT_CATALOG_ENTRY_HEADER(noRotSep);
200  SO_KIT_CATALOG_ENTRY_HEADER(xTranslatorSwitch);
201  SO_KIT_CATALOG_ENTRY_HEADER(xTranslator);
202  SO_KIT_CATALOG_ENTRY_HEADER(xyTranslatorSwitch);
203  SO_KIT_CATALOG_ENTRY_HEADER(xyTranslator);
204 
207  SO_KIT_CATALOG_ENTRY_HEADER(xzTranslatorSwitch);
208  SO_KIT_CATALOG_ENTRY_HEADER(xzTranslator);
209 
212  SO_KIT_CATALOG_ENTRY_HEADER(zTranslatorSwitch);
213  SO_KIT_CATALOG_ENTRY_HEADER(zTranslator);
214  SO_KIT_CATALOG_ENTRY_HEADER(yzTranslatorSwitch);
215  SO_KIT_CATALOG_ENTRY_HEADER(yzTranslator);
216 
219  SO_KIT_CATALOG_ENTRY_HEADER(yTranslatorSwitch);
220  SO_KIT_CATALOG_ENTRY_HEADER(yTranslator);
221 
222  SO_KIT_CATALOG_ENTRY_HEADER(xFeedbackSwitch);
223  SO_KIT_CATALOG_ENTRY_HEADER(xFeedbackSep);
224  SO_KIT_CATALOG_ENTRY_HEADER(xFeedbackTranslation);
225  SO_KIT_CATALOG_ENTRY_HEADER(xFeedback);
226 
227  SO_KIT_CATALOG_ENTRY_HEADER(yFeedbackSwitch);
228  SO_KIT_CATALOG_ENTRY_HEADER(yFeedbackSep);
229  SO_KIT_CATALOG_ENTRY_HEADER(yFeedbackTranslation);
230  SO_KIT_CATALOG_ENTRY_HEADER(yFeedback);
231 
232  SO_KIT_CATALOG_ENTRY_HEADER(zFeedbackSwitch);
233  SO_KIT_CATALOG_ENTRY_HEADER(zFeedbackSep);
234  SO_KIT_CATALOG_ENTRY_HEADER(zFeedbackTranslation);
235  SO_KIT_CATALOG_ENTRY_HEADER(zFeedback);
236 
237  SO_KIT_CATALOG_ENTRY_HEADER(planeFeedbackSep);
238  SO_KIT_CATALOG_ENTRY_HEADER(planeFeedbackTranslation);
239  SO_KIT_CATALOG_ENTRY_HEADER(planeFeedbackSwitch);
240  SO_KIT_CATALOG_ENTRY_HEADER(yzFeedback);
241  SO_KIT_CATALOG_ENTRY_HEADER(xzFeedback);
242  SO_KIT_CATALOG_ENTRY_HEADER(xyFeedback);
243 
244  public:
245 
248 
250 
251  public:
252 
257  void setJumpLimit(float limit) { jumpLimit = limit; }
260  float getJumpLimit() const { return jumpLimit; }
261 
268 
269  SoINTERNAL public:
270  static void initClass();
271 
272  protected:
273 
274  static void startCB( void *, SoDragger * );
275  static void motionCB( void *, SoDragger * );
276  static void finishCB( void *, SoDragger * );
277 
279  static void fieldSensorCB( void *, SoSensor * );
280  static void valueChangedCB( void *, SoDragger * );
281 
282  static void metaKeyChangeCB( void *, SoDragger *);
283 
284  void dragStart();
285  void drag();
286  void dragFinish();
287 
296  virtual bool setUpConnections( bool onOff, bool doItAlways = FALSE );
297 
299 
301 
302  private:
303 
304  SoDragger *currentDragger;
305  SbVec3f startLocalHitPt;
306 
307  bool shftDown;
308 
313  SbBox3f limitBox;
314 
316  float jumpLimit;
317 
320  void setFeedbackGeometry();
321 
323  void checkBoxLimits();
324 
326  void updateLimitBoxAndFeedback();
327 
328  static const unsigned char geomBuffer[];
329 
331  SoNode *oldXAxisNode;
332  SoNode *oldYAxisNode;
333  SoNode *oldZAxisNode;
334 };
335 
336 #endif /* _SO_DRAGPOINT_DRAGGER_ */
#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
3D box class.
Definition: SbBox.h:81
3D vector class.
Definition: SbLinear.h:120
Object you can translate in 3D by dragging with the mouse.
static void motionCB(void *, SoDragger *)
static void valueChangedCB(void *, SoDragger *)
static void metaKeyChangeCB(void *, SoDragger *)
void setJumpLimit(float limit)
Set the point at which the feedback axes will jump to a new position.
virtual bool setUpConnections(bool onOff, bool doItAlways=FALSE)
detach/attach any sensors, callbacks, and/or field connections.
static void initClass()
initialize the class
static void startCB(void *, SoDragger *)
SoDragPointDragger()
Constructor.
static void fieldSensorCB(void *, SoSensor *)
SoFieldSensor * fieldSensor
float getJumpLimit() const
Get the point at which the feedback axes will jump to a new position.
virtual void setDefaultOnNonWritingFields()
Called by the SoBaseKit::write() method.
virtual ~SoDragPointDragger()
static void finishCB(void *, SoDragger *)
void showNextDraggerSet()
The dragPoint dragger contains three pairs of draggers, each containing a plane dragger and a line dr...
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
Abstract base class for all database nodes.
Definition: SoNode.h:103
Field containing a three-dimensional vector.
Definition: SoSFVec3f.h:79
Abstract base class for Inventor sensors.
Definition: SoSensor.h:108