# SoTabPlaneDragger.h

    00001 #ifndef COIN_SOTABPLANEDRAGGER_H
    00002 #define COIN_SOTABPLANEDRAGGER_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 SbLineProjector;
    00033 class SbPlaneProjector;
    00034
    00035
    00036 class COIN_DLL_API SoTabPlaneDragger : public SoDragger {
    00037   typedef SoDragger inherited;
    00038
    00039   SO_KIT_HEADER(SoTabPlaneDragger);
    00040
    00041   SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleCoords);
    00042   SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab0);
    00043   SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab1);
    00044   SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab2);
    00045   SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab3);
    00046   SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleCoords);
    00047   SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab0);
    00048   SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab1);
    00049   SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab2);
    00050   SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab3);
    00051   SO_KIT_CATALOG_ENTRY_HEADER(planeSwitch);
    00052   SO_KIT_CATALOG_ENTRY_HEADER(scaleTabHints);
    00053   SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterial);
    00054   SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterialBinding);
    00055   SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormal);
    00056   SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormalBinding);
    00057   SO_KIT_CATALOG_ENTRY_HEADER(scaleTabs);
    00058   SO_KIT_CATALOG_ENTRY_HEADER(translator);
    00059
    00060
    00061 public:
    00062   static void initClass(void);
    00063   SoTabPlaneDragger(void);
    00064
    00065   SoSFVec3f translation;
    00066   SoSFVec3f scaleFactor;
    00067
    00068   void adjustScaleTabSize(void);
    00069
    00070 protected:
    00071
    00072   ~SoTabPlaneDragger();
    00073
    00074   virtual void GLRender(SoGLRenderAction * action);
    00075
    00076   virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
    00077   virtual void setDefaultOnNonWritingFields(void);
    00078
    00079   void reallyAdjustScaleTabSize(SoGLRenderAction * action);
    00080
    00081   void getXYScreenLengths(SbVec2f & lengths, const SbMatrix & localtoscreen,
    00082                            const SbVec2s & winsize);
    00083
    00084   void dragStart(void);
    00085   void drag(void);
    00086   void dragFinish(void);
    00087
    00088   // Lots of public/protected methods and members were removed from
    00089   // this class as they clearly should have been private.
    00090   // Let us know if we've removed something that you need.
    00091   // pederb, 20000226
    00092
    00093 private:
    00094
    00095   // static methods moved from public to private
    00096   static void startCB(void * f, SoDragger * d);
    00097   static void motionCB(void * f, SoDragger * d);
    00098   static void finishCB(void * f, SoDragger * d);
    00099   static void metaKeyChangeCB(void * f, SoDragger * d);
    00100   static void fieldSensorCB(void * f, SoSensor * s);
    00101   static void valueChangedCB(void * f, SoDragger * d);
    00102
    00103   void createPrivateParts(void);
    00104   SoNode *getNodeFieldNode(const char *fieldname);
    00105
    00106   SoFieldSensor * scaleFieldSensor;
    00107   SoFieldSensor * translFieldSensor;
    00108   SbLineProjector *lineProj;
    00109   SbPlaneProjector *planeProj;
    00110   int whatkind;
    00111   int constraintState;
    00112   float prevsizex;
    00113   float prevsizey;
    00114   SbBool adjustTabs;
    00115   SbVec3f worldRestartPt;
    00116   SbVec3f scaleCenter;
    00117 };
    00118
    00119 #endif // !COIN_SOTABPLANEDRAGGER_H