MeVisLab Toolbox Reference
SoView2DAutoCenter.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#pragma once
14
16
17#include <Inventor/sensors/SoFieldSensor.h>
18
19class SoField;
20
22
24{
25 SO_NODE_HEADER(SoView2DAutoCenter);
26
27public:
28 static void initClass();
29
32
34 SoSFTrigger triggerResetZoom;
35
37 void startDrawing(View2DSliceList *slicelist) override;
38
40 bool evalEvent(SoView2D* view2d, View2DSliceList* slicelist,
41 View2DEvent* ec, View2DEventPhase phase) override;
42
44 void draw(View2DSliceList *slicelist, View2DSlice* slice, int sliceZ) override;
45
47 static void timerSensorCB(void *data, SoSensor *sensor);
48
49protected:
50 void startCenter(SoView2D* view2d, const SbVec3f& voxelPos, bool isInImage);
51 void endCenter();
52
55 void startPressAt(const SoPointerPosition& pos) override;
56 SoPointingAction* endPress(int clickCount) override;
58
64 bool _gotoOn;
67
69 SoTimerSensor* _timer;
72
73private:
74
76 bool _shouldUnzoom;
77
79 void _resetZoom(SoField* field = nullptr);
80};
View2DEventPhase
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoPointerPosition manages the current position of the mouse cursor.
static void timerSensorCB(void *data, SoSensor *sensor)
Callback for timer sensor that is used for smooth zooming.
SoPointingAction * endPress(int clickCount) override
void startCenter(SoView2D *view2d, const SbVec3f &voxelPos, bool isInImage)
bool _shouldReset
flag if the view should reset on next click
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
reimplemented from SoView2DExtension
SoSFTrigger triggerResetZoom
Triggering causes centering of the view.
SoTimerSensor * _timer
the timer that repaints and triggers zooming
void startDrawing(View2DSliceList *slicelist) override
reimplemented from SoView2DExtension
float _newcentery
the new center y that we zoom to
static void initClass()
SoView2D * _zoomView
the SoView2D where the zoom has been started
bool _gotoOn
flag if zooming is currently on
~SoView2DAutoCenter() override
void startPressAt(const SoPointerPosition &pos) override
void draw(View2DSliceList *slicelist, View2DSlice *slice, int sliceZ) override
reimplemented from SoView2DExtension
float _newcenterx
the new center x that we zoom to
SoView2DInteractionExtension(const std::string &actionID, bool positionSensitive=true)
SoView2D is a 2D viewer for image data.
Definition SoView2D.h:62
View2DEvent stores all information on an event on a SoView2D.
a list that holds all View2DSlice objects (lazily created) of a SoView2D
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Definition View2DSlice.h:48