Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoHandleBoxDragger.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** Modified by : David Mott (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_HANDLEBOX_DRAGGER_
52#define _SO_HANDLEBOX_DRAGGER_
53
54#include <Inventor/draggers/SoDragger.h>
55#include <Inventor/fields/SoSFVec3f.h>
56#include <Inventor/sensors/SoSensor.h>
57
58class SbDict;
59class SoDrawStyle;
61class SbLineProjector;
62class SoFieldSensor;
63
65//
66// Class: SoHandleBoxDragger
67//
68// HandleBox dragger - allows user to transform objects.
69//
71
522
523 SO_KIT_HEADER(SoHandleBoxDragger);
524
525 SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
526
527 // For making the dragger surround what lies above it.
528 SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
529
530 SO_KIT_CATALOG_ENTRY_HEADER(translator1Switch);
531 SO_KIT_CATALOG_ENTRY_HEADER(translator1);
532 SO_KIT_CATALOG_ENTRY_HEADER(translator1Active);
533 SO_KIT_CATALOG_ENTRY_HEADER(translator2Switch);
534 SO_KIT_CATALOG_ENTRY_HEADER(translator2);
535 SO_KIT_CATALOG_ENTRY_HEADER(translator2Active);
536 SO_KIT_CATALOG_ENTRY_HEADER(translator3Switch);
537 SO_KIT_CATALOG_ENTRY_HEADER(translator3);
538 SO_KIT_CATALOG_ENTRY_HEADER(translator3Active);
539 SO_KIT_CATALOG_ENTRY_HEADER(translator4Switch);
540 SO_KIT_CATALOG_ENTRY_HEADER(translator4);
541 SO_KIT_CATALOG_ENTRY_HEADER(translator4Active);
542 SO_KIT_CATALOG_ENTRY_HEADER(translator5Switch);
543 SO_KIT_CATALOG_ENTRY_HEADER(translator5);
544 SO_KIT_CATALOG_ENTRY_HEADER(translator5Active);
545 SO_KIT_CATALOG_ENTRY_HEADER(translator6Switch);
546 SO_KIT_CATALOG_ENTRY_HEADER(translator6);
547 SO_KIT_CATALOG_ENTRY_HEADER(translator6Active);
548
549
550 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Switch);
551 SO_KIT_CATALOG_ENTRY_HEADER(extruder1);
552 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Active);
553 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Switch);
554 SO_KIT_CATALOG_ENTRY_HEADER(extruder2);
555 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Active);
556 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Switch);
557 SO_KIT_CATALOG_ENTRY_HEADER(extruder3);
558 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Active);
559 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Switch);
560 SO_KIT_CATALOG_ENTRY_HEADER(extruder4);
561 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Active);
562 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Switch);
563 SO_KIT_CATALOG_ENTRY_HEADER(extruder5);
564 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Active);
565 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Switch);
566 SO_KIT_CATALOG_ENTRY_HEADER(extruder6);
567 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Active);
568
569 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Switch);
570 SO_KIT_CATALOG_ENTRY_HEADER(uniform1);
571 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Active);
572 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Switch);
573 SO_KIT_CATALOG_ENTRY_HEADER(uniform2);
574 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Active);
575 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Switch);
576 SO_KIT_CATALOG_ENTRY_HEADER(uniform3);
577 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Active);
578 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Switch);
579 SO_KIT_CATALOG_ENTRY_HEADER(uniform4);
580 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Active);
581 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Switch);
582 SO_KIT_CATALOG_ENTRY_HEADER(uniform5);
583 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Active);
584 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Switch);
585 SO_KIT_CATALOG_ENTRY_HEADER(uniform6);
586 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Active);
587 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Switch);
588 SO_KIT_CATALOG_ENTRY_HEADER(uniform7);
589 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Active);
590 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Switch);
591 SO_KIT_CATALOG_ENTRY_HEADER(uniform8);
592 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Active);
593
594 SO_KIT_CATALOG_ENTRY_HEADER(arrowTranslation);
595
596 SO_KIT_CATALOG_ENTRY_HEADER(arrow1Switch);
597 SO_KIT_CATALOG_ENTRY_HEADER(arrow1);
598 SO_KIT_CATALOG_ENTRY_HEADER(arrow2Switch);
599 SO_KIT_CATALOG_ENTRY_HEADER(arrow2);
600 SO_KIT_CATALOG_ENTRY_HEADER(arrow3Switch);
601 SO_KIT_CATALOG_ENTRY_HEADER(arrow3);
602 SO_KIT_CATALOG_ENTRY_HEADER(arrow4Switch);
603 SO_KIT_CATALOG_ENTRY_HEADER(arrow4);
604 SO_KIT_CATALOG_ENTRY_HEADER(arrow5Switch);
605 SO_KIT_CATALOG_ENTRY_HEADER(arrow5);
606 SO_KIT_CATALOG_ENTRY_HEADER(arrow6Switch);
607 SO_KIT_CATALOG_ENTRY_HEADER(arrow6);
608
609 public:
614
625
626 private:
627 static void initClass(); // initialize the class
628 static void exitClass();
629
630 private:
631
632 // Callbacks for drag start, motion, and finish
633 static void startCB( void *, SoDragger * );
634 static void motionCB( void *, SoDragger * );
635 static void finishCB( void *, SoDragger * );
636
637 SoFieldSensor *translFieldSensor;
638 SoFieldSensor *scaleFieldSensor;
639 static void fieldSensorCB( void *, SoSensor * );
640 static void valueChangedCB( void *, SoDragger * );
641
642 // Callbacks for pressing and releasing the meta keys
643 static void metaKeyChangeCB( void *, SoDragger *);
644
645 // These really do the work during startCB, motionCB, and finishCB
646 void dragStart();
647 void drag();
648 void dragFinish();
649
650 void setAllPartsActive( SbBool onOrOff );
651
652 // detach/attach any sensors, callbacks, and/or field connections.
653 // Called by: start/end of SoBaseKit::readInstance
654 // and on new copy by: start/end of SoBaseKit::copy.
655 // Classes that redefine must call setUpConnections(TRUE,TRUE)
656 // at end of constructor.
657 // Returns the state of the node when this was called.
658 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
659
660 virtual void setDefaultOnNonWritingFields();
661
662 virtual ~SoHandleBoxDragger();
663
664 private:
665
666 enum WhichAxis
667 { POSX, POSY, POSZ, NEGX, NEGY, NEGZ };
668 void highlightAxisForScale( WhichAxis axis );
669
670 enum State
671 { INACTIVE,
672 SCALE_GEOM_ONLY,
673 RIT_X_SCALE, TOP_Y_SCALE, FNT_Z_SCALE,
674 LFT_X_SCALE, BOT_Y_SCALE, BAK_Z_SCALE,
675
676 PX_PY_PZ_3D_SCALE, PX_PY_NZ_3D_SCALE, PX_NY_PZ_3D_SCALE,
677 PX_NY_NZ_3D_SCALE, NX_PY_PZ_3D_SCALE, NX_PY_NZ_3D_SCALE,
678 NX_NY_PZ_3D_SCALE, NX_NY_NZ_3D_SCALE,
679
680 RIT_TRANSLATE, TOP_TRANSLATE, FNT_TRANSLATE,
681 LFT_TRANSLATE, BOT_TRANSLATE, BAK_TRANSLATE };
682
683 State currentState;
684 int translateDir; // Used for 1-D translation,
685 // this variable records the current
686 // axis being used.
687
688 SbPlaneProjector *motionPlaneProj;
689 SbLineProjector *motionLineProj;
690
691 State restartState; // used by meta callback.
692 SbVec3f worldRestartPt; // used during interaction
693
694 SbBool altDown, ctlDown, shftDown; // used to keep track of
695 // which meta keys were down.
696
697 // functions which do all the work
698 void setHighlights();
699 void setFeedbackArrows();
700
701 SbBool translateInit();
702 SbBool faceScaleInit();
703 SbBool uniformScaleInit();
704 SbBool scaleGeomSizeOnlyInit();
705
706 SbBool translateDrag();
707 SbBool scaleDrag();
708 SbBool scaleGeomSizeOnlyDrag();
709
710 // character strings from which the shared geometry is read
711 static const char geomBuffer[];
712};
713
714#endif /* _SO_HANDLEBOX_DRAGGER_ */
715
Line projector.
Plane projector.
3D vector class.
Definition SbVec.h:932
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Node that defines the style to use when rendering.
Sensor class that can be attached to Open Inventor fields.
Box you can scale, stretch and translate by dragging with the mouse.
SoHandleBoxDragger()
Constructor.
SoSFVec3f translation
Position of the dragger.
SoSFVec3f scaleFactor
Scale of the dragger.
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
int SbBool
Boolean type.
Definition SbBase.h:87