Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# SoVRMLDragSensor.h

    00001 /**************************************************************************\
    00002  *
    00003  *  This file is part of the Coin 3D visualization library.
    00004  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00005  *
    00006  *  This library is free software; you can redistribute it and/or
    00007  *  modify it under the terms of the GNU General Public License
    00008  *  ("GPL") version 2 as published by the Free Software Foundation.
    00009  *  See the file LICENSE.GPL at the root directory of this source
    00010  *  distribution for additional information about the GNU GPL.
    00011  *
    00012  *  For using Coin with software that can not be combined with the GNU
    00013  *  GPL, and for taking advantage of the additional benefits of our
    00014  *  support services, please contact Systems in Motion about acquiring
    00015  *  a Coin Professional Edition License.
    00016  *
    00017  *  See <URL:http://www.coin3d.org> for  more information.
    00018  *
    00019  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00020  *  <URL:http://www.sim.no>.
    00021  *
    00022 \**************************************************************************/
    00023
    00024 #ifndef COIN_SOVRMLDRAGSENSOR_H
    00025 #define COIN_SOVRMLDRAGSENSOR_H
    00026
    00027 #include <Inventor/nodes/SoSubNode.h>
    00028 #include <Inventor/VRMLnodes/SoVRMLSensor.h>
    00029 #include <Inventor/fields/SoSFVec3f.h>
    00030 #include <Inventor/SbVec2s.h>
    00031 #include <Inventor/SbVec2f.h>
    00032 #include <Inventor/SbMatrix.h>
    00033 #include <Inventor/SbViewVolume.h>
    00034
    00035 class SbMatrix;
    00036
    00037 class COIN_DLL_API SoVRMLDragSensor : public SoVRMLSensor {
    00038   typedef SoVRMLSensor inherited;
    00039
    00040   SO_NODE_ABSTRACT_HEADER(SoVRMLDragSensor);
    00041
    00042 public:
    00043   SoSFVec3f trackPoint_changed;
    00044   SoSFBool autoOffset;
    00045
    00046   //  virtual void GLRender(SoGLRenderAction * action);
    00047   virtual void handleEvent(SoHandleEventAction * action);
    00048   static void initClass(void);
    00049
    00050 protected:
    00051
    00052   virtual SbBool dragStart(void) = 0;
    00053   virtual void drag(void) = 0;
    00054   virtual void dragFinish(void) = 0;
    00055
    00056   SoVRMLDragSensor(void);
    00057   virtual ~SoVRMLDragSensor();
    00058
    00059   const SbVec3f & getLocalStartingPoint(void) const;
    00060   const SbMatrix & getLocalToWorldMatrix(void) const;
    00061   const SbMatrix & getWorldToLocalMatrix(void) const;
    00062   const SbViewVolume & getViewVolume(void) const;
    00063   const SbVec2f & getNormalizedLocaterPosition(void) const;
    00064
    00065 private:
    00066   // FIXME: move to private class
    00067   SbVec3f hitpt;
    00068   SbMatrix obj2world;
    00069   SbMatrix world2obj;
    00070   SbVec2s mousepos;
    00071   SbVec2f normpos;
    00072   SbViewVolume viewvolume;
    00073 };
    00074
    00075 #endif // ! COIN_SOVRMLDRAGSENSOR_H