MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoView2D/extensions/SoView2DPosition.h
Go to the documentation of this file.
00001 #ifndef __SoView2DPosition_H
00002 #define __SoView2DPosition_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 <Inventor/fields/SoSFFloat.h>
00022 #include <Inventor/fields/SoSFVec3f.h>
00023 #include <Inventor/fields/SoSFBool.h>
00024 #include <Inventor/fields/SoSFColor.h>
00025 #include <Inventor/fields/SoSFInt32.h>
00026 #include <XVLeaveScope.h>
00027 
00028 typedef enum { DRAWINGMODEL_CROSSHAIRS, DRAWINGMODEL_CIRCLE, DRAWINGMODEL_VOXEL_RECT, DRAWINGMODEL_ELLIPSE } drawingModelType;
00029 
00031 class SOVIEW2D_API SoView2DPosition: public SoView2DInteractionExtension {
00032 
00033   SO_NODE_HEADER(SoView2DPosition);
00034 
00035 public:
00037 
00038   SoSFVec3f worldPosition;
00040   SoSFEnum  drawingModel;
00042   SoSFInt32 drawingModelSize;
00044   SoSFInt32 crossHairSpacing;
00046   SoSFBool  drawEditingRect;
00048   SoSFBool  colorAxes;
00050   SoSFColor coronalColor;
00052   SoSFColor axialColor;
00054   SoSFColor sagittalColor;
00055 
00057   SoSFBool colorBorder;
00059   SoSFFloat colorBorderWidth;
00060 
00062   SoSFFloat lineWidth;
00063 
00065   SoSFFloat blendOnto;
00067   SoSFFloat blendOutside;
00068 
00070   SoSFBool  updateOnPress;
00072   SoSFBool  updateOnMotion;
00074   SoSFBool  updateOnRelease;
00076   SoSFBool  cooperative;
00078   SoSFVec3f firstSliceWorldPosition;
00079 
00081 
00083   static void   initClass();
00084 
00086   SoView2DPosition();
00087 
00089   void   draw(View2DSliceList *dsl, View2DSlice* dslice, int slice);
00091   bool   evalEvent(SoView2D* view2d, View2DSliceList* slicelist,
00092     View2DEvent* ec, View2DEventPhase phase);
00093 
00095   bool ignoreEvent(View2DEvent* ec);
00096 
00097 protected:
00098   // update worldPosition and firstSliceWorldPosition
00099   void setPosition(const SbVec3f& pos, SoView2D* view2d, View2DSliceList* slicelist);
00100 
00102   void getAxisColor(char orientation, float* color);
00103 
00105 
00106   virtual bool isSensitiveAt(const SoPointerPosition& pos);
00107   virtual void startPressAt(const SoPointerPosition& pos);
00108   virtual void dragMoveTo(const SoPointerPosition& pos);
00110 
00112   SbVec3f _oldWorldPos;
00114   bool    _isDragging;
00115 };
00116 
00117 #endif