MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoView2DPosition.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
15
16#pragma once
17
19
20#include <Inventor/fields/SoSFVec3f.h>
21#include <Inventor/fields/SoSFFloat.h>
22#include <Inventor/fields/SoSFVec3f.h>
23#include <Inventor/fields/SoSFBool.h>
24#include <Inventor/fields/SoSFColor.h>
25#include <Inventor/fields/SoSFInt32.h>
26#include <Inventor/fields/SoSFUShort.h>
27
28#include <Inventor/SbBox.h>
29
37
43
46{
47 SO_NODE_HEADER(SoView2DPosition);
48
49public:
71
76
81
86
97
99
101 static void initClass();
102
105
107 void draw(View2DSliceList* dsl, View2DSlice* dslice, int slice) override;
108
110 bool evalEvent(SoView2D* view2d, View2DSliceList* slicelist, View2DEvent* ec, View2DEventPhase phase) override;
111
113 bool ignoreEvent(View2DEvent* ec) override;
114
115protected:
116 // update worldPosition and firstSliceWorldPosition
117 void setPosition(const SbVec3f& pos, SoView2D* view2d, View2DSliceList* slicelist);
118
120 void getAxisColor(char orientation, float* color);
121
124 bool isSensitiveAt(const SoPointerPosition& pos) override;
125 void startPressAt(const SoPointerPosition& pos) override;
126 void dragMoveTo(const SoPointerPosition& pos) override;
128
131 void pointerPosition(const SoPointerPosition& pos) override;
132
137
138private:
139 void drawCrosshairs(View2DSliceList* dsl, View2DSlice* dslice, const SbVec3f& voxelPosition, float* rgba);
140
141 void drawRect(View2DSlice* dslice, const SbVec3f& voxelPosition, float* rgba);
142
143 void drawEllipse(View2DSlice* dslice, const SbVec3f& voxelPosition);
144
145 void drawBorder(View2DSliceList* dsl, View2DSlice* dslice, float* rgba);
146
147 void calculateModelSize(View2DSlice* dslice, float vz, float& modelSize, float& modelSizeX_px, float& modelSizeY_px);
148
149 SbBox2f calculateBoundingBox(const SbVec2f& modelCenter, float modelSizeX_px, float modelSizeY_px);
150
151 SbVec2f calculateModelCenter(View2DSlice* dslice, const SbVec3f& voxelPosition);
152
153 void setAxesColors(View2DSliceList* dsl, float* rgba);
154};
View2DEventPhase
event phase for simple extensions that grab the focus, do something (motion) and are released afterwa...
SizeUnitType
@ SIZEUNIT_SCREEN
@ SIZEUNIT_WORLD
@ SIZEUNIT_VOXEL
drawingModelType
Draw and edit a position on the SoView2D.
@ DRAWINGMODEL_ELLIPSE
@ DRAWINGMODEL_CROSSHAIRS
@ DRAWINGMODEL_CROSSHAIRS_WITH_CIRCLE
@ DRAWINGMODEL_VOXEL_RECT
@ DRAWINGMODEL_CIRCLE
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
void pointerPosition(SoState *state, const SoPointerPosition &pos) override
Same as below, with additional SoState argument. By default, simply calls the below version.
SoPointerPosition manages the current position of the mouse cursor.
SoView2DInteractionExtension is base class for all SoView2DExtensions that want to support the Manage...
draw and edit a position on the SoView2D
SoSFBool colorAxes
flag to draw axes in color
SoSFBool updateOnRelease
update worldPosition on release event
SoSFBool updateOnPress
update worldPosition on press event
bool _isDragging
flag if position is being dragged
SoSFFloat blendOutside
blend factor for the slice the position is not located on
void pointerPosition(const SoPointerPosition &pos) override
Override this if you always need to be informed of the current mouse cursor position.
SoSFFloat crossHairSpacing
spacing in center of the crosshair position indicator
SoSFFloat drawingModelSize
size of the position indicator model
void startPressAt(const SoPointerPosition &pos) override
SoView2DPosition()
Constructor.
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
reimplemented from SoView2DExtension
SoSFVec3f firstSliceWorldPosition
world position on first slice (useful, if numOfSlices in the corresponding viewer is > 1)
SoSFBool updateOnMotion
update worldPosition on motion event
SoSFColor coronalColor
color for coronal view
SoSFEnum drawingModel
model that shall be used for the position indicator (crosshairs, circle...)
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
reimplemented from SoView2DExtension
SoSFColor sagittalColor
color for sagittal view
SoSFUShort linePattern
line stipple pattern
SoSFBool drawEditingRect
flag to draw mini rect in cursor center
SoSFBool cooperative
enable cooperative editing
SoSFBool colorBorder
flag to draw colored borders
SoSFFloat blendOnto
blend factor for the slice the position is located on
bool ignoreEvent(View2DEvent *ec) override
Overwrite ignoreEvent -> ignore the "ignoreHandledEvents"-Field.
SbVec3f _oldWorldPos
previous world position
SoSFColor axialColor
color for axial view
void getAxisColor(char orientation, float *color)
get color of orientation
SoSFEnum drawingModelSizeUnit
unit in which cross-hair dimensions are expressed (voxel, world or screen units)
bool isSensitiveAt(const SoPointerPosition &pos) override
interface forwarded from SoPointingAction:
static void initClass()
inventor runtime type system
SoSFFloat lineWidth
line width of the rendered position indicators
SoSFFloat colorBorderWidth
width of the color border
void dragMoveTo(const SoPointerPosition &pos) override
void setPosition(const SbVec3f &pos, SoView2D *view2d, View2DSliceList *slicelist)
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
Target mlrange_cast(Source arg)
Generic version of checked ML casts.