00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SOHANDLEBOXDRAGGER_H
00021 #define COIN_SOHANDLEBOXDRAGGER_H
00022
00023 #include <Inventor/draggers/SoDragger.h>
00024 #include <Inventor/fields/SoSFVec3f.h>
00025
00026 class SoSensor;
00027 class SoFieldSensor;
00028 class SbPlaneProjector;
00029 class SbLineProjector;
00030
00031 class COIN_DLL_API SoHandleBoxDragger : public SoDragger {
00032 typedef SoDragger inherited;
00033
00034 SO_KIT_HEADER(SoHandleBoxDragger);
00035
00036 SO_KIT_CATALOG_ENTRY_HEADER(arrow1);
00037 SO_KIT_CATALOG_ENTRY_HEADER(arrow1Switch);
00038 SO_KIT_CATALOG_ENTRY_HEADER(arrow2);
00039 SO_KIT_CATALOG_ENTRY_HEADER(arrow2Switch);
00040 SO_KIT_CATALOG_ENTRY_HEADER(arrow3);
00041 SO_KIT_CATALOG_ENTRY_HEADER(arrow3Switch);
00042 SO_KIT_CATALOG_ENTRY_HEADER(arrow4);
00043 SO_KIT_CATALOG_ENTRY_HEADER(arrow4Switch);
00044 SO_KIT_CATALOG_ENTRY_HEADER(arrow5);
00045 SO_KIT_CATALOG_ENTRY_HEADER(arrow5Switch);
00046 SO_KIT_CATALOG_ENTRY_HEADER(arrow6);
00047 SO_KIT_CATALOG_ENTRY_HEADER(arrow6Switch);
00048 SO_KIT_CATALOG_ENTRY_HEADER(arrowTranslation);
00049 SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
00050 SO_KIT_CATALOG_ENTRY_HEADER(extruder1);
00051 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Active);
00052 SO_KIT_CATALOG_ENTRY_HEADER(extruder1Switch);
00053 SO_KIT_CATALOG_ENTRY_HEADER(extruder2);
00054 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Active);
00055 SO_KIT_CATALOG_ENTRY_HEADER(extruder2Switch);
00056 SO_KIT_CATALOG_ENTRY_HEADER(extruder3);
00057 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Active);
00058 SO_KIT_CATALOG_ENTRY_HEADER(extruder3Switch);
00059 SO_KIT_CATALOG_ENTRY_HEADER(extruder4);
00060 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Active);
00061 SO_KIT_CATALOG_ENTRY_HEADER(extruder4Switch);
00062 SO_KIT_CATALOG_ENTRY_HEADER(extruder5);
00063 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Active);
00064 SO_KIT_CATALOG_ENTRY_HEADER(extruder5Switch);
00065 SO_KIT_CATALOG_ENTRY_HEADER(extruder6);
00066 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Active);
00067 SO_KIT_CATALOG_ENTRY_HEADER(extruder6Switch);
00068 SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
00069 SO_KIT_CATALOG_ENTRY_HEADER(translator1);
00070 SO_KIT_CATALOG_ENTRY_HEADER(translator1Active);
00071 SO_KIT_CATALOG_ENTRY_HEADER(translator1Switch);
00072 SO_KIT_CATALOG_ENTRY_HEADER(translator2);
00073 SO_KIT_CATALOG_ENTRY_HEADER(translator2Active);
00074 SO_KIT_CATALOG_ENTRY_HEADER(translator2Switch);
00075 SO_KIT_CATALOG_ENTRY_HEADER(translator3);
00076 SO_KIT_CATALOG_ENTRY_HEADER(translator3Active);
00077 SO_KIT_CATALOG_ENTRY_HEADER(translator3Switch);
00078 SO_KIT_CATALOG_ENTRY_HEADER(translator4);
00079 SO_KIT_CATALOG_ENTRY_HEADER(translator4Active);
00080 SO_KIT_CATALOG_ENTRY_HEADER(translator4Switch);
00081 SO_KIT_CATALOG_ENTRY_HEADER(translator5);
00082 SO_KIT_CATALOG_ENTRY_HEADER(translator5Active);
00083 SO_KIT_CATALOG_ENTRY_HEADER(translator5Switch);
00084 SO_KIT_CATALOG_ENTRY_HEADER(translator6);
00085 SO_KIT_CATALOG_ENTRY_HEADER(translator6Active);
00086 SO_KIT_CATALOG_ENTRY_HEADER(translator6Switch);
00087 SO_KIT_CATALOG_ENTRY_HEADER(uniform1);
00088 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Active);
00089 SO_KIT_CATALOG_ENTRY_HEADER(uniform1Switch);
00090 SO_KIT_CATALOG_ENTRY_HEADER(uniform2);
00091 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Active);
00092 SO_KIT_CATALOG_ENTRY_HEADER(uniform2Switch);
00093 SO_KIT_CATALOG_ENTRY_HEADER(uniform3);
00094 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Active);
00095 SO_KIT_CATALOG_ENTRY_HEADER(uniform3Switch);
00096 SO_KIT_CATALOG_ENTRY_HEADER(uniform4);
00097 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Active);
00098 SO_KIT_CATALOG_ENTRY_HEADER(uniform4Switch);
00099 SO_KIT_CATALOG_ENTRY_HEADER(uniform5);
00100 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Active);
00101 SO_KIT_CATALOG_ENTRY_HEADER(uniform5Switch);
00102 SO_KIT_CATALOG_ENTRY_HEADER(uniform6);
00103 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Active);
00104 SO_KIT_CATALOG_ENTRY_HEADER(uniform6Switch);
00105 SO_KIT_CATALOG_ENTRY_HEADER(uniform7);
00106 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Active);
00107 SO_KIT_CATALOG_ENTRY_HEADER(uniform7Switch);
00108 SO_KIT_CATALOG_ENTRY_HEADER(uniform8);
00109 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Active);
00110 SO_KIT_CATALOG_ENTRY_HEADER(uniform8Switch);
00111
00112 public:
00113 static void initClass(void);
00114 SoHandleBoxDragger(void);
00115
00116 SoSFVec3f scaleFactor;
00117 SoSFVec3f translation;
00118
00119 protected:
00120 ~SoHandleBoxDragger();
00121 virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
00122 virtual void setDefaultOnNonWritingFields(void);
00123
00124 static void startCB(void * f, SoDragger * d);
00125 static void motionCB(void * f, SoDragger * d);
00126 static void finishCB(void * f, SoDragger * d);
00127 static void metaKeyChangeCB(void * f, SoDragger * d);
00128 static void fieldSensorCB(void * f, SoSensor * s);
00129 static void valueChangedCB(void * f, SoDragger * d);
00130
00131 void dragStart(void);
00132 void drag(void);
00133 void dragFinish(void);
00134 void setAllPartsActive(SbBool onoroff);
00135
00136 SoFieldSensor * translFieldSensor;
00137 SoFieldSensor * scaleFieldSensor;
00138
00139 private:
00140
00141 void updateSwitches();
00142 void updateArrows();
00143 SoNode *getNodeFieldNode(const char *fieldname);
00144 SbPlaneProjector *planeProj;
00145 SbLineProjector *lineProj;
00146 int whatkind;
00147 int whatnum;
00148 int constraintState;
00149 SbBool ctrlDown;
00150 SbVec3f worldRestartPt;
00151 SbVec3f ctrlOffset;
00152
00153 void getSurroundScaleMatrices(SbMatrix &matrix, SbMatrix &inv);
00154 SbVec3f getDraggerCenter();
00155 SbVec3f calcCtrlOffset(const SbVec3f startpt);
00156 };
00157
00158 #endif // !COIN_SOHANDLEBOXDRAGGER_H