00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_HANDLEBOX_DRAGGER_
00052 #define _SO_HANDLEBOX_DRAGGER_
00053
00054 #include <Inventor/draggers/SoDragger.h>
00055 #include <Inventor/fields/SoSFVec3f.h>
00056 #include <Inventor/sensors/SoSensor.h>
00057
00058 class SbDict;
00059 class SoDrawStyle;
00060 class SbPlaneProjector;
00061 class SbLineProjector;
00062 class SoFieldSensor;
00063
00065
00066
00067
00068
00069
00071
00521 class SoHandleBoxDragger : public SoDragger {
00522
00523 SO_KIT_HEADER(SoHandleBoxDragger);
00524
00525 SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
00526
00527
00528 SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
00529
00530 SO_KIT_CATALOG_ENTRY_HEADER(translator1Switch);
00531 SO_KIT_CATALOG_ENTRY_HEADER(translator1);
00532 SO_KIT_CATALOG_ENTRY_HEADER(translator1Active);
00533 SO_KIT_CATALOG_ENTRY_HEADER(translator2Switch);
00534 SO_KIT_CATALOG_ENTRY_HEADER(translator2);
00535 SO_KIT_CATALOG_ENTRY_HEADER(translator2Active);
00536 SO_KIT_CATALOG_ENTRY_HEADER(translator3Switch);
00537 SO_KIT_CATALOG_ENTRY_HEADER(translator3);
00538 SO_KIT_CATALOG_ENTRY_HEADER(translator3Active);
00539 SO_KIT_CATALOG_ENTRY_HEADER(translator4Switch);
00540 SO_KIT_CATALOG_ENTRY_HEADER(translator4);
00541 SO_KIT_CATALOG_ENTRY_HEADER(translator4Active);
00542 SO_KIT_CATALOG_ENTRY_HEADER(translator5Switch);
00543 SO_KIT_CATALOG_ENTRY_HEADER(translator5);
00544 SO_KIT_CATALOG_ENTRY_HEADER(translator5Active);
00545 SO_KIT_CATALOG_ENTRY_HEADER(translator6Switch);
00546 SO_KIT_CATALOG_ENTRY_HEADER(translator6);
00547 SO_KIT_CATALOG_ENTRY_HEADER(translator6Active);
00548
00549
00550 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Switch);
00551 SO_KIT_CATALOG_ENTRY_HEADER(extruder1);
00552 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Active);
00553 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Switch);
00554 SO_KIT_CATALOG_ENTRY_HEADER(extruder2);
00555 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Active);
00556 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Switch);
00557 SO_KIT_CATALOG_ENTRY_HEADER(extruder3);
00558 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Active);
00559 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Switch);
00560 SO_KIT_CATALOG_ENTRY_HEADER(extruder4);
00561 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Active);
00562 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Switch);
00563 SO_KIT_CATALOG_ENTRY_HEADER(extruder5);
00564 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Active);
00565 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Switch);
00566 SO_KIT_CATALOG_ENTRY_HEADER(extruder6);
00567 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Active);
00568
00569 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Switch);
00570 SO_KIT_CATALOG_ENTRY_HEADER(uniform1);
00571 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Active);
00572 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Switch);
00573 SO_KIT_CATALOG_ENTRY_HEADER(uniform2);
00574 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Active);
00575 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Switch);
00576 SO_KIT_CATALOG_ENTRY_HEADER(uniform3);
00577 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Active);
00578 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Switch);
00579 SO_KIT_CATALOG_ENTRY_HEADER(uniform4);
00580 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Active);
00581 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Switch);
00582 SO_KIT_CATALOG_ENTRY_HEADER(uniform5);
00583 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Active);
00584 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Switch);
00585 SO_KIT_CATALOG_ENTRY_HEADER(uniform6);
00586 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Active);
00587 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Switch);
00588 SO_KIT_CATALOG_ENTRY_HEADER(uniform7);
00589 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Active);
00590 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Switch);
00591 SO_KIT_CATALOG_ENTRY_HEADER(uniform8);
00592 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Active);
00593
00594 SO_KIT_CATALOG_ENTRY_HEADER(arrowTranslation);
00595
00596 SO_KIT_CATALOG_ENTRY_HEADER(arrow1Switch);
00597 SO_KIT_CATALOG_ENTRY_HEADER(arrow1);
00598 SO_KIT_CATALOG_ENTRY_HEADER(arrow2Switch);
00599 SO_KIT_CATALOG_ENTRY_HEADER(arrow2);
00600 SO_KIT_CATALOG_ENTRY_HEADER(arrow3Switch);
00601 SO_KIT_CATALOG_ENTRY_HEADER(arrow3);
00602 SO_KIT_CATALOG_ENTRY_HEADER(arrow4Switch);
00603 SO_KIT_CATALOG_ENTRY_HEADER(arrow4);
00604 SO_KIT_CATALOG_ENTRY_HEADER(arrow5Switch);
00605 SO_KIT_CATALOG_ENTRY_HEADER(arrow5);
00606 SO_KIT_CATALOG_ENTRY_HEADER(arrow6Switch);
00607 SO_KIT_CATALOG_ENTRY_HEADER(arrow6);
00608
00609 public:
00613 SoHandleBoxDragger();
00614
00619 SoSFVec3f translation;
00624 SoSFVec3f scaleFactor;
00625
00626 private:
00627 static void initClass();
00628 static void exitClass();
00629
00630 private:
00631
00632
00633 static void startCB( void *, SoDragger * );
00634 static void motionCB( void *, SoDragger * );
00635 static void finishCB( void *, SoDragger * );
00636
00637 SoFieldSensor *translFieldSensor;
00638 SoFieldSensor *scaleFieldSensor;
00639 static void fieldSensorCB( void *, SoSensor * );
00640 static void valueChangedCB( void *, SoDragger * );
00641
00642
00643 static void metaKeyChangeCB( void *, SoDragger *);
00644
00645
00646 void dragStart();
00647 void drag();
00648 void dragFinish();
00649
00650 void setAllPartsActive( SbBool onOrOff );
00651
00652
00653
00654
00655
00656
00657
00658 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
00659
00660 virtual void setDefaultOnNonWritingFields();
00661
00662 virtual ~SoHandleBoxDragger();
00663
00664 private:
00665
00666 enum WhichAxis
00667 { POSX, POSY, POSZ, NEGX, NEGY, NEGZ };
00668 void highlightAxisForScale( WhichAxis axis );
00669
00670 enum State
00671 { INACTIVE,
00672 SCALE_GEOM_ONLY,
00673 RIT_X_SCALE, TOP_Y_SCALE, FNT_Z_SCALE,
00674 LFT_X_SCALE, BOT_Y_SCALE, BAK_Z_SCALE,
00675
00676 PX_PY_PZ_3D_SCALE, PX_PY_NZ_3D_SCALE, PX_NY_PZ_3D_SCALE,
00677 PX_NY_NZ_3D_SCALE, NX_PY_PZ_3D_SCALE, NX_PY_NZ_3D_SCALE,
00678 NX_NY_PZ_3D_SCALE, NX_NY_NZ_3D_SCALE,
00679
00680 RIT_TRANSLATE, TOP_TRANSLATE, FNT_TRANSLATE,
00681 LFT_TRANSLATE, BOT_TRANSLATE, BAK_TRANSLATE };
00682
00683 State currentState;
00684 int translateDir;
00685
00686
00687
00688 SbPlaneProjector *motionPlaneProj;
00689 SbLineProjector *motionLineProj;
00690
00691 State restartState;
00692 SbVec3f worldRestartPt;
00693
00694 SbBool altDown, ctlDown, shftDown;
00695
00696
00697
00698 void setHighlights();
00699 void setFeedbackArrows();
00700
00701 SbBool translateInit();
00702 SbBool faceScaleInit();
00703 SbBool uniformScaleInit();
00704 SbBool scaleGeomSizeOnlyInit();
00705
00706 SbBool translateDrag();
00707 SbBool scaleDrag();
00708 SbBool scaleGeomSizeOnlyDrag();
00709
00710
00711 static const char geomBuffer[];
00712 };
00713
00714 #endif
00715
00716