Open Inventor Release 2024.1.1
 
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-2023 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(tabsShader);
228 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterial);
229 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabHints);
230 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterialBinding);
231 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormalBinding);
232 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormal);
233 SO_KIT_CATALOG_ENTRY_HEADER(scaleTabPixelSize);
234 SO_KIT_CATALOG_ENTRY_HEADER(edgeType0);
235 SO_KIT_CATALOG_ENTRY_HEADER(edgeType1);
236 SO_KIT_CATALOG_ENTRY_HEADER(edgeType2);
237 SO_KIT_CATALOG_ENTRY_HEADER(edgeType3);
238 SO_KIT_CATALOG_ENTRY_HEADER(showEdges);
239 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner0);
240 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner1);
241 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner2);
242 SO_KIT_CATALOG_ENTRY_HEADER(edgeTypeCorner3);
243 SO_KIT_CATALOG_ENTRY_HEADER(scaleCoords);
244 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale0);
245 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale1);
246 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale2);
247 SO_KIT_CATALOG_ENTRY_HEADER(edgeScale3);
248 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator0);
249 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator1);
250 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator2);
251 SO_KIT_CATALOG_ENTRY_HEADER(edgeSeparator3);
252 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation0);
253 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation1);
254 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation2);
255 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTranslation3);
256 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab0);
257 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab1);
258 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab2);
259 SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab3);
260 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale0);
261 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale1);
262 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale2);
263 SO_KIT_CATALOG_ENTRY_HEADER(cornerScale3);
264 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch0);
265 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch1);
266 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch2);
267 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch3);
268 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch4);
269 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch5);
270 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch6);
271 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightSwitch7);
272 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial0);
273 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial1);
274 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial2);
275 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightMaterial3);
276 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial4);
277 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial5);
278 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial6);
279 SO_KIT_CATALOG_ENTRY_HEADER(tabHighLightMaterial7);
280 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale0);
281 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale1);
282 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale2);
283 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale3);
284 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale4);
285 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale5);
286 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale6);
287 SO_KIT_CATALOG_ENTRY_HEADER(tabHighlightScale7);
288 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator0);
289 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator1);
290 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator2);
291 SO_KIT_CATALOG_ENTRY_HEADER(cornerSeparator3);
292 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation0);
293 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation1);
294 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation2);
295 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTranslation3);
296 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab0);
297 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab1);
298 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab2);
299 SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab3);
300 SO_KIT_CATALOG_ENTRY_HEADER(translatorMaterial);
301 SO_KIT_CATALOG_ENTRY_HEADER(translatorDrawStyle);
302 SO_KIT_CATALOG_ENTRY_HEADER(translatorCoordinates);
303
304public:
309
314
319
327
334
341
348
355
365
367 void showEdgeScales( const SbBool show );
368
370 void showCornerScales( const SbBool show );
371
372 private:
374 static void initClass();
376 static void exitClass();
377
378 int getCurrentState();
379
380 void notify( SoNotList* list );
381
382private:
383
385 SoSwitch* m_edgeSwitch;
386
388 SoSwitch* m_cornerSwitch;
389
390 //sensor to detect twoSidedLighting changes
391 SoFieldSensor *lightingSensor;
392
393 //sensor to detect twoSidedLighting changes
394 SoFieldSensor *lineWidthSensor;
395
396 static void lightingSensorCB( void *, SoSensor * );
397 static void lineWidthSensorCB( void *, SoSensor * );
398
399 static void startCB( void *, SoDragger *);
400 static void motionCB( void *, SoDragger *);
401 static void finishCB( void *, SoDragger *);
402 static void metaKeyChangeCB( void *, SoDragger *);
403
404 SbLineProjector *lineProj;
405 SbPlaneProjector *planeProj;
406
407 SoFieldSensor *translFieldSensor;
408 SoFieldSensor *scaleFieldSensor;
409 static void fieldSensorCB( void *, SoSensor * );
410 static void valueChangedCB( void *, SoDragger * );
411
412 virtual void GLRender( SoGLRenderAction *action );
413 virtual void rayPick(SoRayPickAction *action);
414
415 void dragStart();
416 void drag();
417 void dragFinish();
418
419 void translateStart();
420 void translateDrag();
421
422 void edgeScaleStart();
423 void edgeScaleDrag();
424
425 void cornerScaleStart();
426 void cornerScaleDrag();
427
428 void scaleUniformStart();
429 void scaleUniformDrag();
430
431 SbVec3f worldRestartPt;
432 int currentScalePatch;
433
434 enum State {
435 INACTIVE, TRANSLATING, EDGE_SCALING, CORNER_SCALING, UNIFORM_SCALING
436 };
437 SbBool shftDown;
438
439 State currentState;
440 State restartState;
441 int translateDir;
442
443 SbVec3f scaleCenter;
444
445 // detach/attach any sensors, callbacks, and/or field connections.
446 // Called by: start/end of SoBaseKit::readInstance
447 // and on new copy by: start/end of SoBaseKit::copy.
448 // Classes that redefine must call setUpConnections(TRUE,TRUE)
449 // at end of constructor.
450 // Returns the state of the node when this was called.
451 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
452
453 virtual void setDefaultOnNonWritingFields();
454
455 virtual ~SoTabPlaneDragger();
456
457 private:
458 static const char geomBuffer[];
459 static bool s_resizeOnInactiveOnly;
460 static SoShaderProgram* s_tabsShader;
461 static const float s_tabHighlightScaleCoef;
462};
463
464#endif /* _SO_TAB_PLANE_DRAGGER_ */
465
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