# SoHandleBoxDragger.h

    00001 #ifndef COIN_SOHANDLEBOXDRAGGER_H
    00002 #define COIN_SOHANDLEBOXDRAGGER_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/draggers/SoDragger.h>
    00028 #include <Inventor/fields/SoSFVec3f.h>
    00029
    00030 class SoSensor;
    00031 class SoFieldSensor;
    00032 class SbPlaneProjector;
    00033 class SbLineProjector;
    00034
    00035 class COIN_DLL_API SoHandleBoxDragger : public SoDragger {
    00036   typedef SoDragger inherited;
    00037
    00038   SO_KIT_HEADER(SoHandleBoxDragger);
    00039
    00040   SO_KIT_CATALOG_ENTRY_HEADER(arrow1);
    00041   SO_KIT_CATALOG_ENTRY_HEADER(arrow1Switch);
    00042   SO_KIT_CATALOG_ENTRY_HEADER(arrow2);
    00043   SO_KIT_CATALOG_ENTRY_HEADER(arrow2Switch);
    00044   SO_KIT_CATALOG_ENTRY_HEADER(arrow3);
    00045   SO_KIT_CATALOG_ENTRY_HEADER(arrow3Switch);
    00046   SO_KIT_CATALOG_ENTRY_HEADER(arrow4);
    00047   SO_KIT_CATALOG_ENTRY_HEADER(arrow4Switch);
    00048   SO_KIT_CATALOG_ENTRY_HEADER(arrow5);
    00049   SO_KIT_CATALOG_ENTRY_HEADER(arrow5Switch);
    00050   SO_KIT_CATALOG_ENTRY_HEADER(arrow6);
    00051   SO_KIT_CATALOG_ENTRY_HEADER(arrow6Switch);
    00052   SO_KIT_CATALOG_ENTRY_HEADER(arrowTranslation);
    00053   SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
    00054   SO_KIT_CATALOG_ENTRY_HEADER(extruder1);
    00055   SO_KIT_CATALOG_ENTRY_HEADER(extruder1Active);
    00056   SO_KIT_CATALOG_ENTRY_HEADER(extruder1Switch);
    00057   SO_KIT_CATALOG_ENTRY_HEADER(extruder2);
    00058   SO_KIT_CATALOG_ENTRY_HEADER(extruder2Active);
    00059   SO_KIT_CATALOG_ENTRY_HEADER(extruder2Switch);
    00060   SO_KIT_CATALOG_ENTRY_HEADER(extruder3);
    00061   SO_KIT_CATALOG_ENTRY_HEADER(extruder3Active);
    00062   SO_KIT_CATALOG_ENTRY_HEADER(extruder3Switch);
    00063   SO_KIT_CATALOG_ENTRY_HEADER(extruder4);
    00064   SO_KIT_CATALOG_ENTRY_HEADER(extruder4Active);
    00065   SO_KIT_CATALOG_ENTRY_HEADER(extruder4Switch);
    00066   SO_KIT_CATALOG_ENTRY_HEADER(extruder5);
    00067   SO_KIT_CATALOG_ENTRY_HEADER(extruder5Active);
    00068   SO_KIT_CATALOG_ENTRY_HEADER(extruder5Switch);
    00069   SO_KIT_CATALOG_ENTRY_HEADER(extruder6);
    00070   SO_KIT_CATALOG_ENTRY_HEADER(extruder6Active);
    00071   SO_KIT_CATALOG_ENTRY_HEADER(extruder6Switch);
    00072   SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
    00073   SO_KIT_CATALOG_ENTRY_HEADER(translator1);
    00074   SO_KIT_CATALOG_ENTRY_HEADER(translator1Active);
    00075   SO_KIT_CATALOG_ENTRY_HEADER(translator1Switch);
    00076   SO_KIT_CATALOG_ENTRY_HEADER(translator2);
    00077   SO_KIT_CATALOG_ENTRY_HEADER(translator2Active);
    00078   SO_KIT_CATALOG_ENTRY_HEADER(translator2Switch);
    00079   SO_KIT_CATALOG_ENTRY_HEADER(translator3);
    00080   SO_KIT_CATALOG_ENTRY_HEADER(translator3Active);
    00081   SO_KIT_CATALOG_ENTRY_HEADER(translator3Switch);
    00082   SO_KIT_CATALOG_ENTRY_HEADER(translator4);
    00083   SO_KIT_CATALOG_ENTRY_HEADER(translator4Active);
    00084   SO_KIT_CATALOG_ENTRY_HEADER(translator4Switch);
    00085   SO_KIT_CATALOG_ENTRY_HEADER(translator5);
    00086   SO_KIT_CATALOG_ENTRY_HEADER(translator5Active);
    00087   SO_KIT_CATALOG_ENTRY_HEADER(translator5Switch);
    00088   SO_KIT_CATALOG_ENTRY_HEADER(translator6);
    00089   SO_KIT_CATALOG_ENTRY_HEADER(translator6Active);
    00090   SO_KIT_CATALOG_ENTRY_HEADER(translator6Switch);
    00091   SO_KIT_CATALOG_ENTRY_HEADER(uniform1);
    00092   SO_KIT_CATALOG_ENTRY_HEADER(uniform1Active);
    00093   SO_KIT_CATALOG_ENTRY_HEADER(uniform1Switch);
    00094   SO_KIT_CATALOG_ENTRY_HEADER(uniform2);
    00095   SO_KIT_CATALOG_ENTRY_HEADER(uniform2Active);
    00096   SO_KIT_CATALOG_ENTRY_HEADER(uniform2Switch);
    00097   SO_KIT_CATALOG_ENTRY_HEADER(uniform3);
    00098   SO_KIT_CATALOG_ENTRY_HEADER(uniform3Active);
    00099   SO_KIT_CATALOG_ENTRY_HEADER(uniform3Switch);
    00100   SO_KIT_CATALOG_ENTRY_HEADER(uniform4);
    00101   SO_KIT_CATALOG_ENTRY_HEADER(uniform4Active);
    00102   SO_KIT_CATALOG_ENTRY_HEADER(uniform4Switch);
    00103   SO_KIT_CATALOG_ENTRY_HEADER(uniform5);
    00104   SO_KIT_CATALOG_ENTRY_HEADER(uniform5Active);
    00105   SO_KIT_CATALOG_ENTRY_HEADER(uniform5Switch);
    00106   SO_KIT_CATALOG_ENTRY_HEADER(uniform6);
    00107   SO_KIT_CATALOG_ENTRY_HEADER(uniform6Active);
    00108   SO_KIT_CATALOG_ENTRY_HEADER(uniform6Switch);
    00109   SO_KIT_CATALOG_ENTRY_HEADER(uniform7);
    00110   SO_KIT_CATALOG_ENTRY_HEADER(uniform7Active);
    00111   SO_KIT_CATALOG_ENTRY_HEADER(uniform7Switch);
    00112   SO_KIT_CATALOG_ENTRY_HEADER(uniform8);
    00113   SO_KIT_CATALOG_ENTRY_HEADER(uniform8Active);
    00114   SO_KIT_CATALOG_ENTRY_HEADER(uniform8Switch);
    00115
    00116 public:
    00117   static void initClass(void);
    00118   SoHandleBoxDragger(void);
    00119
    00120   SoSFVec3f scaleFactor;
    00121   SoSFVec3f translation;
    00122
    00123 protected:
    00124   ~SoHandleBoxDragger();
    00125   virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
    00126   virtual void setDefaultOnNonWritingFields(void);
    00127
    00128   static void startCB(void * f, SoDragger * d);
    00129   static void motionCB(void * f, SoDragger * d);
    00130   static void finishCB(void * f, SoDragger * d);
    00131   static void metaKeyChangeCB(void * f, SoDragger * d);
    00132   static void fieldSensorCB(void * f, SoSensor * s);
    00133   static void valueChangedCB(void * f, SoDragger * d);
    00134
    00135   void dragStart(void);
    00136   void drag(void);
    00137   void dragFinish(void);
    00138   void setAllPartsActive(SbBool onoroff);
    00139
    00140   SoFieldSensor * translFieldSensor;
    00141   SoFieldSensor * scaleFieldSensor;
    00142
    00143 private:
    00144
    00145   void updateSwitches();
    00146   void updateArrows();
    00147   SoNode *getNodeFieldNode(const char *fieldname);
    00148   SbPlaneProjector *planeProj;
    00149   SbLineProjector *lineProj;
    00150   int whatkind;
    00151   int whatnum;
    00152   int constraintState;
    00153   SbBool ctrlDown;
    00154   SbVec3f worldRestartPt;
    00155   SbVec3f ctrlOffset;
    00156
    00157   void getSurroundScaleMatrices(SbMatrix &matrix, SbMatrix &inv);
    00158   SbVec3f getDraggerCenter();
    00159   SbVec3f calcCtrlOffset(const SbVec3f startpt);
    00160 };
    00161
    00162 #endif // !COIN_SOHANDLEBOXDRAGGER_H