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

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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

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