Open Inventor Release 2024.2.2
 
Loading...
Searching...
No Matches
SoTabPlaneDragger.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul Isaacs (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_TAB_PLANE_DRAGGER_
51#define _SO_TAB_PLANE_DRAGGER_
52
53#include <Inventor/SbLinear.h>
54#include <Inventor/sensors/SoSensor.h>
55#include <Inventor/projectors/SbLineProjector.h>
56#include <Inventor/projectors/SbPlaneProjector.h>
57#include <Inventor/actions/SoCallbackAction.h>
58#include <Inventor/draggers/SoDragger.h>
59
60class SoNode;
61class SoCoordinate3;
63class SoRayPickAction;
64class SoFieldSensor;
65class SoSwitch;
66class SoShaderProgram;
67
220{
221 // Define typeId and name stuff
222 SO_KIT_HEADER(SoTabPlaneDragger);
223
224 SO_KIT_CATALOG_ENTRY_HEADER(planeSwitch);
225 SO_KIT_CATALOG_ENTRY_HEADER(translator);
226 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabs);
227 SO_KIT_CATALOG_ENTRY_HEADER(tabsCallback);
228 SO_KIT_CATALOG_ENTRY_HEADER(tabsShader);
229 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterial);
230 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabHints);
231 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterialBinding);
232 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormalBinding);
233 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormal);
234 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabPixelSize);
235 SO_KIT_CATALOG_ENTRY_HEADER(edgeType0);
236 SO_KIT_CATALOG_ENTRY_HEADER(edgeType1);
237 SO_KIT_CATALOG_ENTRY_HEADER(edgeType2);
238 SO_KIT_CATALOG_ENTRY_HEADER(edgeType3);
239 SO_KIT_CATALOG_ENTRY_HEADER(showEdges);
240 SO_KIT_CATALOG_ENTRY_HEADER(showCorners);
241 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner0);
242 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner1);
243 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner2);
244 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner3);
245 SO_KIT_CATALOG_ENTRY_HEADER(scaleCoords);
246 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale0);
247 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale1);
248 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale2);
249 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale3);
250 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator0);
251 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator1);
252 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator2);
253 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator3);
254 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation0);
255 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation1);
256 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation2);
257 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation3);
258 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab0);
259 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab1);
260 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab2);
261 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab3);
262 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale0);
263 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale1);
264 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale2);
265 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale3);
266 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch0);
267 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch1);
268 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch2);
269 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch3);
270 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch4);
271 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch5);
272 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch6);
273 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch7);
274 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial0);
275 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial1);
276 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial2);
277 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial3);
278 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial4);
279 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial5);
280 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial6);
281 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial7);
282 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale0);
283 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale1);
284 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale2);
285 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale3);
286 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale4);
287 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale5);
288 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale6);
289 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale7);
290 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator0);
291 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator1);
292 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator2);
293 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator3);
294 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation0);
295 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation1);
296 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation2);
297 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation3);
298 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab0);
299 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab1);
300 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab2);
301 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab3);
302 SO_KIT_CATALOG_ENTRY_HEADER(translatorMaterial);
303 SO_KIT_CATALOG_ENTRY_HEADER(translatorDrawStyle);
304 SO_KIT_CATALOG_ENTRY_HEADER(translatorCoordinates);
305
306public:
311
316
321
329
336
343
350
357
367
369 void showEdgeScales( const SbBool show );
370
372 void showCornerScales( const SbBool show );
373
374 private:
376 static void initClass();
378 static void exitClass();
379
380 int getCurrentState();
381
382 void notify( SoNotList* list );
383
384private:
385
386 //sensor to detect twoSidedLighting changes
387 SoFieldSensor *lightingSensor;
388
389 //sensor to detect twoSidedLighting changes
390 SoFieldSensor *lineWidthSensor;
391
392 static void lightingSensorCB( void *, SoSensor * );
393 static void lineWidthSensorCB( void *, SoSensor * );
394
395 static void startCB( void *, SoDragger *);
396 static void motionCB( void *, SoDragger *);
397 static void finishCB( void *, SoDragger *);
398 static void metaKeyChangeCB( void *, SoDragger *);
399
400 SbLineProjector *lineProj;
401 SbPlaneProjector *planeProj;
402
403 SoFieldSensor *translFieldSensor;
404 SoFieldSensor *scaleFieldSensor;
405 static void fieldSensorCB( void *, SoSensor * );
406 static void valueChangedCB( void *, SoDragger * );
407
408 virtual void GLRender( SoGLRenderAction *action );
409 virtual void rayPick(SoRayPickAction *action);
410
411 void dragStart();
412 void drag();
413 void dragFinish();
414
415 void translateStart();
416 void translateDrag();
417
418 void edgeScaleStart();
419 void edgeScaleDrag();
420
421 void cornerScaleStart();
422 void cornerScaleDrag();
423
424 void scaleUniformStart();
425 void scaleUniformDrag();
426
427 SbVec3f worldRestartPt;
428 int currentScalePatch;
429
430 enum State {
431 INACTIVE, TRANSLATING, EDGE_SCALING, CORNER_SCALING, UNIFORM_SCALING
432 };
433 SbBool shftDown;
434
435 State currentState;
436 State restartState;
437 int translateDir;
438
439 SbVec3f scaleCenter;
440
441 // detach/attach any sensors, callbacks, and/or field connections.
442 // Called by: start/end of SoBaseKit::readInstance
443 // and on new copy by: start/end of SoBaseKit::copy.
444 // Classes that redefine must call setUpConnections(TRUE,TRUE)
445 // at end of constructor.
446 // Returns the state of the node when this was called.
447 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
448
449 virtual void setDefaultOnNonWritingFields();
450
451 virtual ~SoTabPlaneDragger();
452
453 private:
454 static const char geomBuffer[];
455 static bool s_resizeOnInactiveOnly;
456 static SoShaderProgram* s_tabsShader;
457 static const float s_tabHighlightScaleCoef;
458};
459
460#endif /* _SO_TAB_PLANE_DRAGGER_ */
461
Line projector.
Plane projector.
3D vector class.
Definition SbVec.h:932
Coordinate point node.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Sensor class that can be attached to Open Inventor fields.
Renders a scene graph using Open Inventor's Render Engine.
Abstract base class for all database nodes.
Definition SoNode.h:145
Intersects objects with a ray cast into scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Shader program p...
Group node that traverses one chosen child.
Definition SoSwitch.h:179
Object you can translate or scale within a plane by dragging with the mouse.
SoSFBool resizeHandles
If set to TRUE, handles will be resized automatically when the view matrix (camera) changes.
SoSFInt32 tabPixelSize
Specifies the size of the green tabs in pixels.
SoSFBool twoSidedLighting
If set to TRUE, OpenGL two sided lighting will be enabled.
SoSFVec3f translation
Position of the dragger.
SoSFVec3f scaleFactor
Scale factor affecting the dragger.
SoSFFloat lineWidth
Specifies the line width for the outline box.
void showEdgeScales(const SbBool show)
show or hide edges
void adjustScaleTabSize()
Causes the scale tab sizes to be adjusted so that they remain a near constant screen space size.
SoTabPlaneDragger()
Constructor.
SoSFBool scaleUniform
If set to TRUE, scaling will always be uniform.
void showCornerScales(const SbBool show)
show or hide corners
int SbBool
Boolean type.
Definition SbBase.h:87