| http://www.sim.no/ http://www.coin3d.org/

SoHandleBoxDragger.h
1 #ifndef COIN_SOHANDLEBOXDRAGGER_H
2 #define COIN_SOHANDLEBOXDRAGGER_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/draggers/SoDragger.h>
28 #include <Inventor/tools/SbLazyPimplPtr.h>
29 #include <Inventor/fields/SoSFVec3f.h>
30
31 class SoSensor;
32 class SoFieldSensor;
33 class SbPlaneProjector;
34 class SbLineProjector;
35 class SoHandleBoxDraggerP;
36
37 class COIN_DLL_API SoHandleBoxDragger : public SoDragger {
38 typedef SoDragger inherited;
39
40 SO_KIT_HEADER(SoHandleBoxDragger);
41 SO_KIT_CATALOG_ENTRY_HEADER(arrow1);
42 SO_KIT_CATALOG_ENTRY_HEADER(arrow1Switch);
43 SO_KIT_CATALOG_ENTRY_HEADER(arrow2);
44 SO_KIT_CATALOG_ENTRY_HEADER(arrow2Switch);
45 SO_KIT_CATALOG_ENTRY_HEADER(arrow3);
46 SO_KIT_CATALOG_ENTRY_HEADER(arrow3Switch);
47 SO_KIT_CATALOG_ENTRY_HEADER(arrow4);
48 SO_KIT_CATALOG_ENTRY_HEADER(arrow4Switch);
49 SO_KIT_CATALOG_ENTRY_HEADER(arrow5);
50 SO_KIT_CATALOG_ENTRY_HEADER(arrow5Switch);
51 SO_KIT_CATALOG_ENTRY_HEADER(arrow6);
52 SO_KIT_CATALOG_ENTRY_HEADER(arrow6Switch);
53 SO_KIT_CATALOG_ENTRY_HEADER(arrowTranslation);
54 SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
55 SO_KIT_CATALOG_ENTRY_HEADER(extruder1);
56 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Active);
57 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Switch);
58 SO_KIT_CATALOG_ENTRY_HEADER(extruder2);
59 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Active);
60 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Switch);
61 SO_KIT_CATALOG_ENTRY_HEADER(extruder3);
62 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Active);
63 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Switch);
64 SO_KIT_CATALOG_ENTRY_HEADER(extruder4);
65 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Active);
66 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Switch);
67 SO_KIT_CATALOG_ENTRY_HEADER(extruder5);
68 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Active);
69 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Switch);
70 SO_KIT_CATALOG_ENTRY_HEADER(extruder6);
71 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Active);
72 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Switch);
73 SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
74 SO_KIT_CATALOG_ENTRY_HEADER(translator1);
75 SO_KIT_CATALOG_ENTRY_HEADER(translator1Active);
76 SO_KIT_CATALOG_ENTRY_HEADER(translator1Switch);
77 SO_KIT_CATALOG_ENTRY_HEADER(translator2);
78 SO_KIT_CATALOG_ENTRY_HEADER(translator2Active);
79 SO_KIT_CATALOG_ENTRY_HEADER(translator2Switch);
80 SO_KIT_CATALOG_ENTRY_HEADER(translator3);
81 SO_KIT_CATALOG_ENTRY_HEADER(translator3Active);
82 SO_KIT_CATALOG_ENTRY_HEADER(translator3Switch);
83 SO_KIT_CATALOG_ENTRY_HEADER(translator4);
84 SO_KIT_CATALOG_ENTRY_HEADER(translator4Active);
85 SO_KIT_CATALOG_ENTRY_HEADER(translator4Switch);
86 SO_KIT_CATALOG_ENTRY_HEADER(translator5);
87 SO_KIT_CATALOG_ENTRY_HEADER(translator5Active);
88 SO_KIT_CATALOG_ENTRY_HEADER(translator5Switch);
89 SO_KIT_CATALOG_ENTRY_HEADER(translator6);
90 SO_KIT_CATALOG_ENTRY_HEADER(translator6Active);
91 SO_KIT_CATALOG_ENTRY_HEADER(translator6Switch);
92 SO_KIT_CATALOG_ENTRY_HEADER(uniform1);
93 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Active);
94 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Switch);
95 SO_KIT_CATALOG_ENTRY_HEADER(uniform2);
96 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Active);
97 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Switch);
98 SO_KIT_CATALOG_ENTRY_HEADER(uniform3);
99 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Active);
100 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Switch);
101 SO_KIT_CATALOG_ENTRY_HEADER(uniform4);
102 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Active);
103 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Switch);
104 SO_KIT_CATALOG_ENTRY_HEADER(uniform5);
105 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Active);
106 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Switch);
107 SO_KIT_CATALOG_ENTRY_HEADER(uniform6);
108 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Active);
109 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Switch);
110 SO_KIT_CATALOG_ENTRY_HEADER(uniform7);
111 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Active);
112 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Switch);
113 SO_KIT_CATALOG_ENTRY_HEADER(uniform8);
114 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Active);
115 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Switch);
116
117 public:
118 static void initClass(void);
119 SoHandleBoxDragger(void);
120
121 SoSFVec3f scaleFactor;
122 SoSFVec3f translation;
123
124 protected:
125 virtual ~SoHandleBoxDragger(void);
126 virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
127 virtual void setDefaultOnNonWritingFields(void);
128
129 static void startCB(void * f, SoDragger * d);
130 static void motionCB(void * f, SoDragger * d);
131 static void finishCB(void * f, SoDragger * d);
132 static void metaKeyChangeCB(void * f, SoDragger * d);
133 static void fieldSensorCB(void * f, SoSensor * s);
134 static void valueChangedCB(void * f, SoDragger * d);
135
136 void dragStart(void);
137 void drag(void);
138 void dragFinish(void);
139 void setAllPartsActive(SbBool onoroff);
140
141 SoFieldSensor * translFieldSensor;
142 SoFieldSensor * scaleFieldSensor;
143
144 private:
145 void updateSwitches();
146 void updateArrows();
147 SoNode *getNodeFieldNode(const char *fieldname);
148 SbPlaneProjector *planeProj;
149 SbLineProjector *lineProj;
150 int whatkind;
151 int whatnum;
152 int constraintState;
153 SbBool ctrlDown;
154 SbVec3f worldRestartPt;
155 SbVec3f ctrlOffset;
156
157 void getSurroundScaleMatrices(SbMatrix &matrix, SbMatrix &inv);
158 SbVec3f getDraggerCenter();
159 SbVec3f calcCtrlOffset(const SbVec3f startpt);
160
161 private:
162 SbLazyPimplPtr<SoHandleBoxDraggerP> pimpl;
163
164 // NOT IMPLEMENTED:
165 SoHandleBoxDragger(const SoHandleBoxDragger & rhs);
166 SoHandleBoxDragger & operator = (const SoHandleBoxDragger & rhs);
167 }; // SoHandleBoxDragger
168
169 #endif // !COIN_SOHANDLEBOXDRAGGER_H
SoHandleBoxDragger::translFieldSensor
SoFieldSensor * translFieldSensor
Definition: SoHandleBoxDragger.h:141
SoInteractionKit::fieldSensorCB
static void fieldSensorCB(void *, SoSensor *)
Definition: SoInteractionKit.cpp:742
SoHandleBoxDragger::scaleFactor
SoSFVec3f scaleFactor
Definition: SoHandleBoxDragger.h:121
SoHandleBoxDragger
The SoHandleBoxDragger class provides support for interactive scaling and translation.Here&#39;s how the dragger looks with its default geometry in the inactive state:
Definition: SoHandleBoxDragger.h:37
SoNode
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoInteractionKit
The SoInteractionKit class is a base class for draggers.This nodekit class makes it possible to set s...
Definition: SoInteractionKit.h:41
SoDragger
The SoDragger class is the base class for all draggers.Draggers is a mechanism used for letting the e...
Definition: SoDragger.h:55
SoSensor
The SoSensor class is the abstract base class for all sensors.Sensors is a mechanism in Coin for sche...
Definition: SoSensor.h:34
SoDragger::initClass
static void initClass(void)
Definition: SoDragger.cpp:399
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SoHandleBoxDragger::scaleFieldSensor
SoFieldSensor * scaleFieldSensor
Definition: SoHandleBoxDragger.h:142
SoFieldSensor
The SoFieldSensor class detects changes to a field.Attach a field to a sensor of this type to put it ...
Definition: SoFieldSensor.h:29
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.SbMatrix is used by many other cla...
Definition: SbMatrix.h:37
SbPlaneProjector
The SbPlaneProjector class projects 2D points to 3D points in a plane.The 3D projection of the 2D coo...
Definition: SbPlaneProjector.h:31
SoSFVec3f
The SoSFVec3f class is a container for an SbVec3f vector.This field is used where nodes...
Definition: SoSFVec3f.h:31
SoHandleBoxDragger::translation
SoSFVec3f translation
Definition: SoHandleBoxDragger.h:122
SbLineProjector
The SbLineProjector class projects 2D points to 3D points along a line.The 3D projection of the 2D co...
Definition: SbLineProjector.h:32
SoInteractionKit::setUpConnections
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition: SoInteractionKit.cpp:665
SoDragger.h
SoDragger::setDefaultOnNonWritingFields
virtual void setDefaultOnNonWritingFields(void)
Definition: SoDragger.cpp:1791

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.