MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoView2D/extensions/SoView2DRectangle.h
Go to the documentation of this file.
00001 #ifndef __SoView2DRectangle_H
00002 #define __SoView2DRectangle_H
00003 //----------------------------------------------------------------------------------
00004 // **InsertLicense** code
00005 //----------------------------------------------------------------------------------
00007 
00013 //----------------------------------------------------------------------------------
00014 
00015 #ifndef __SoView2DInteractionExtension_H
00016 #include "SoView2DInteractionExtension.h"
00017 #endif
00018 
00019 #include <XVEnterScope.h>
00020 #include <Inventor/fields/SoSFVec3f.h>
00021 #include <XVLeaveScope.h>
00022 
00024 class SOVIEW2D_API SoView2DRectangle : public SoView2DInteractionExtension {
00025 
00026   SO_NODE_HEADER(SoView2DRectangle);
00027 
00028 public:
00029 
00031 
00033   SoSFVec3f startWorldPos;
00035   SoSFVec3f endWorldPos;
00036 
00038   SoSFFloat blendInside;
00040   SoSFFloat blendOnto;
00042   SoSFFloat blendOutside;
00044   SoSFFloat lineBlendInside;
00046   SoSFFloat lineBlendOnto;
00048   SoSFFloat lineBlendOutside;
00049 
00051   SoSFBool resetToImage;
00052 
00054   SoSFBool selectOutside;
00055 
00057   SoSFBool allowDrag;
00058 
00060   SoSFBool  cooperative;
00061 
00063   SoSFFloat shadeExterior;
00064 
00066 
00068   static void   initClass();
00069 
00071   SoView2DRectangle();
00072 
00074   void   draw(View2DSliceList *dsl, View2DSlice* dslice, int slice);
00076   bool   evalEvent(SoView2D* view2d, View2DSliceList* slicelist,
00077     View2DEvent* ec, View2DEventPhase phase);
00078   
00080   bool ignoreEvent(View2DEvent* ec);
00081 
00082 protected:
00084   enum DragMode {DragNothing, DragAnyPoint, DragRect, DragCreateRect};
00085 
00088   DragMode performHitTest(int dx1, int dy1, const SbVec3f& voxelPos, View2DSliceList* slicelist);
00089 
00091   void performDrag(const SbVec3f& voxelPos, bool setStart, View2DSliceList* slicelist);
00092 
00094 
00095   virtual bool isSensitiveAt(const SoPointerPosition& pos);
00096   virtual void startPressAt(const SoPointerPosition& pos);
00097   virtual void dragMoveTo(const SoPointerPosition& pos);
00098   virtual SoPointingAction* endPress(int clickCount);
00100 
00102   DragMode _dragMode;
00103 
00105 
00106 
00107   bool _xhigher;
00109   bool _yhigher;
00110 
00112   bool _dragx;
00114   bool _dragy;
00116 
00118   SbVec3f _lastWorldPos;
00119 
00121   bool  _draggingInCooperativeMode;
00122 };
00123 
00124 #endif