MeVisLabToolboxReference
|
00001 #ifndef __View2DPosition_H 00002 #define __View2DPosition_H 00003 //---------------------------------------------------------------------------------- 00004 // **InsertLicense** code 00005 //---------------------------------------------------------------------------------- 00008 00014 //---------------------------------------------------------------------------------- 00015 00016 #include "XVEnterScope.h" 00017 #include <Inventor/SbLinear.h> 00018 #include "XVLeaveScope.h" 00019 00020 #ifndef __SoView2DSystem_H 00021 #include "SoView2DSystem.h" 00022 #endif 00023 #ifndef __SoSFMLImage_H 00024 #include "SoSFMLImage.h" 00025 #endif 00026 00027 class SoView2D; 00028 class View2DSliceList; 00029 00032 class SOVIEW2D_API View2DPosition 00033 { 00034 public: 00036 View2DPosition(SoView2D* viewer = NULL); 00037 ~View2DPosition() {} 00038 00041 SbVec2f getDevicePosition() const { return _relPos; } 00042 00044 SbVec3f getVoxelPosition() const { return _voxelPos; } 00045 00047 SbVec2f getViewportOrigin() const { return _vpOrigin; } 00049 SbVec2f getViewportSize() const { return _vpSize; } 00050 00052 SoSFMLImage& getImage() const; 00053 00055 SoView2D* getViewer() const { return _viewer; } 00056 00058 View2DSliceList* getSliceList() const; 00059 00061 void mapVoxelToWorld (const SbVec3f &src, SbVec3f &dst) const { getImage().mapVoxelToWorld (src, dst); } 00062 00064 void mapWorldToVoxel (const SbVec3f &src, SbVec3f &dst) const { getImage().mapWorldToVoxel (src, dst); } 00065 00067 bool isInsideImage() const; 00068 00070 bool isInsideViewport() const; 00071 00072 SbVec3f getWorldPosition() const; 00073 00074 protected: 00075 // change methods are implemented in MutableView2DPosition in SoView2D.cpp 00076 SbVec2f _relPos; 00077 SbVec3f _voxelPos; 00078 SbVec2f _vpOrigin; 00079 SbVec2f _vpSize; 00080 private: 00081 SoView2D* _viewer; 00082 }; 00083 00084 #endif