Open Inventor Reference
SoTabPlaneDragger.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 tab plane dragger class.
48  | This dragger allows you to perform scales
49  | and translations, all in one tidy plane.
50  |
51  | NOTE TO DEVELOPERS:
52  | For info about the structure of SoTabPlaneDragger:
53  | [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
54  | [2] type: ivNodeKitStructure SoTabPlaneDragger.
55  | [3] The program prints a diagram of the scene graph and a table with
56  | information about each part.
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  | tabPlaneTranslator - translator
66  | tabPlaneScaleTabMaterial - scaleTabMaterial
67  | tabPlaneScaleTabHints - scaleTabHints
68  |
69  |
70  | Author(s): Paul Isaacs
71  |
72  ______________ S I L I C O N G R A P H I C S I N C . ____________
73  _______________________________________________________________________
74  */
75 
76 #ifndef _SO_TAB_PLANE_DRAGGER_
77 #define _SO_TAB_PLANE_DRAGGER_
78 
79 #include <Inventor/SbLinear.h>
85 
86 class SoNode;
87 class SoCoordinate3;
88 class SoGLRenderAction;
89 class SoRayPickAction;
90 class SoFieldSensor;
91 
94 
171 
173 {
176 
177  SO_KIT_CATALOG_ENTRY_HEADER(planeSwitch);
178  SO_KIT_CATALOG_ENTRY_HEADER(translator);
179  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabs);
180  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterial);
181  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabHints);
182  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterialBinding);
183  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormalBinding);
184  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormal);
185  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleCoords);
186  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab0);
187  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab1);
188  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab2);
189  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab3);
190  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleCoords);
191  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab0);
192  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab1);
193  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab2);
194  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab3);
195 
196  public:
197 
200 
203 
210 
211  SoINTERNAL public:
212  static void initClass();
213 
214  protected:
215 
216  static void startCB( void *, SoDragger *);
217  static void motionCB( void *, SoDragger *);
218  static void finishCB( void *, SoDragger *);
219  static void metaKeyChangeCB( void *, SoDragger *);
220 
223 
226  static void fieldSensorCB( void *, SoSensor * );
227  static void valueChangedCB( void *, SoDragger * );
228 
229  virtual void GLRender( SoGLRenderAction *action );
230 
231  void dragStart();
232  void drag();
233  void dragFinish();
234 
237 
240 
243 
246 
249 
250  enum State {
251  INACTIVE, TRANSLATING, EDGE_SCALING, CORNER_SCALING, UNIFORM_SCALING
252  };
253  bool shftDown;
254 
258 
260 
263 
264  void getXYScreenLengths( SbVec2f &lengths, const SbMatrix &localToScreen,
265  const SbVec2s &winSize);
266 
273  virtual bool setUpConnections( bool onOff, bool doItAlways = FALSE );
274 
276 
278 
279  private:
280  static const unsigned char geomBuffer[];
281 };
282 
283 #endif /* _SO_TAB_PLANE_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
Line projector.
4x4 matrix class.
Definition: SbLinear.h:823
Plane projector.
2D vector class.
Definition: SbLinear.h:246
2D vector class.
Definition: SbLinear.h:354
3D vector class.
Definition: SbLinear.h:120
Coordinate point node.
Definition: SoCoordinate3.h:94
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
Renders a scene graph using OpenGL.
Abstract base class for all database nodes.
Definition: SoNode.h:103
Intersects objects with a ray cast into scene.
Field containing a three-dimensional vector.
Definition: SoSFVec3f.h:79
Abstract base class for Inventor sensors.
Definition: SoSensor.h:108
Object you can translate or scale within a plane by dragging with the mouse.
virtual bool setUpConnections(bool onOff, bool doItAlways=FALSE)
detach/attach any sensors, callbacks, and/or field connections.
virtual void GLRender(SoGLRenderAction *action)
These virtual functions implement all of the actions for nodes, Most of the default implementations d...
virtual ~SoTabPlaneDragger()
static void motionCB(void *, SoDragger *)
virtual void setDefaultOnNonWritingFields()
Called by the SoBaseKit::write() method.
SbLineProjector * lineProj
void scaleUniformStart()
SbPlaneProjector * planeProj
SoFieldSensor * scaleFieldSensor
static void fieldSensorCB(void *, SoSensor *)
static void finishCB(void *, SoDragger *)
static void metaKeyChangeCB(void *, SoDragger *)
static void valueChangedCB(void *, SoDragger *)
void getXYScreenLengths(SbVec2f &lengths, const SbMatrix &localToScreen, const SbVec2s &winSize)
static void startCB(void *, SoDragger *)
static void initClass()
initialize the class
void adjustScaleTabSize()
Cause the scale tab sizes to be re-adjusted so that they remain a near constant screen space size.
void reallyAdjustScaleTabSize(SoGLRenderAction *action)
SoFieldSensor * translFieldSensor
SoTabPlaneDragger()
Constructor.