MeVisLabToolboxReference
|
00001 #ifndef __SoView2DAutoCenter_H 00002 #define __SoView2DAutoCenter_H 00003 // **InsertLicense** code 00004 //---------------------------------------------------------------------------------- 00011 //---------------------------------------------------------------------------------- 00012 00013 #ifndef __SoView2DInteractionExtension_H 00014 #include "SoView2DInteractionExtension.h" 00015 #endif 00016 00017 #include <Inventor/sensors/SoFieldSensor.h> 00018 00019 00022 class SOVIEW2D_API SoView2DAutoCenter : public SoView2DInteractionExtension { 00023 00024 SO_NODE_HEADER(SoView2DAutoCenter); 00025 00026 public: 00027 static void initClass(); 00028 00029 SoView2DAutoCenter(); 00030 ~SoView2DAutoCenter(); 00031 00033 SoSFTrigger triggerResetZoom; 00034 00036 virtual void startDrawing(View2DSliceList *slicelist); 00037 00039 virtual bool evalEvent(SoView2D* view2d, View2DSliceList* slicelist, 00040 View2DEvent* ec, View2DEventPhase phase); 00041 00043 virtual void draw(View2DSliceList *slicelist, View2DSlice* slice, int sliceZ); 00044 00046 static void timerSensorCB(void *data, SoSensor *sensor); 00047 00048 protected: 00049 void startCenter(SoView2D* view2d, const SbVec3f& voxelPos, bool isInImage); 00050 void endCenter(); 00051 00053 00054 virtual void startPressAt(const SoPointerPosition& pos); 00055 virtual SoPointingAction* endPress(int clickCount); 00057 00059 float _newcenterx; 00061 float _newcentery; 00063 bool _gotoOn; 00065 bool _shouldReset; 00066 00068 SoTimerSensor* _timer; 00070 SoView2D* _zoomView; 00071 00072 private: 00073 00075 bool _shouldUnzoom; 00076 00078 void _resetZoom(); 00079 00081 SoFieldSensor* _triggerResetZoomSensor; 00082 00084 static void triggerResetZoomCB(void *data, SoSensor* a); 00085 00086 }; 00087 00088 #endif