MeVisLab Toolbox Reference
SoCSOPointEditor.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2012, 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
21
23
25
28{
29 SO_NODE_HEADER(SoCSOPointEditor);
30
31public:
32
35
37 SoSFEnum drawingMode;
38
42 SoSFTypedEnum<VoxelSnapMode> voxelSnapMode;
43
45 void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos, const CSODrawSliceInformation& drawSliceInfo, SoView2DCSOExtensibleEditor* editor) override;
46
48 static void initClass();
49
50 void cancel() override;
51
52 bool isCreationAllowedAt(const SoPointerPosition& pos) const override;
53 void createStartPressAt(const SoPointerPosition& pos) override;
54 void createDragMoveTo(const SoPointerPosition& pos) override;
55 bool createEndPress(int clickCount) override;
57
59 void selectAndMoveDragMoveTo(const SoPointerPosition& pos) override;
60 SoPointingAction* selectAndMoveEndPress(int clickCount) override;
61
63 {
64 POINT_DRAWING_MODE_POINT = 0,
65 POINT_DRAWING_MODE_CROSSHAIR = 1
66 };
67
68protected:
69
70private:
71 // move given point into image boundaries, returns true if point was modified
72 bool clipPointToImageBoundaries(ml::Vector3& point, const SoPointerPosition& pos);
73 // same for whole CSO
74 bool clipCSOToImageBoundaries(ml::CSO* cso, const SoPointerPosition& pos);
75
76 void snapToVoxelGrid(SbVec3f& position, const SoPointerPosition& pos) const;
77 void snapToVoxelGrid(ml::Vector3& position, const SoPointerPosition& pos) const;
78
79 void renderCrosshair(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos, const CSODrawSliceInformation& drawSliceInfo);
80 void renderCrosshair(int deviceXCenter, int deviceYCenter, const SbColor& color, float alpha) const;
81 void glRenderOpaqueLine(int deviceXStart, int deviceYStart, int deviceXEnd, int deviceYEnd, const SbColor& color, float alpha) const;
82 void glRenderFadingOutLine(int deviceXStart, int deviceYStart, int deviceXEnd, int deviceYEnd, const SbColor& color, float alpha) const;
83
84 void glVertex2fWithMagicOffset(float x, float y) const;
85
86 bool _wasCanceled;
87
88 SbVec3f _startPosition;
89 SbVec3f _startOffset;
90};
91
VoxelSnapMode
Extension for rendering, generating, and modifying a point CSO.
@ SNAP_Z
@ SNAP_XYZ
@ SNAP_XY
@ SNAP_OFF
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition SoCSOSystem.h:21
Base class for extensions that extend the editor with interaction and rendering for specific CSO type...
Extension for rendering, generating, and modifying a point CSO.
void pointerPositionIfAllowedAt(const SoPointerPosition &) override
Sets seed points while moving the mouse – but not while dragging.
static void initClass()
init class in inventor runtime
void selectAndMoveStartPressAt(const SoPointerPosition &pos) override
SoCSOPointEditor()
Standard constructor.
void draw(const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &drawSliceInfo, SoView2DCSOExtensibleEditor *editor) override
Drawing routine.
bool createEndPress(int clickCount) override
void createStartPressAt(const SoPointerPosition &pos) override
SoSFEnum drawingMode
Sets the drawing mode.
void selectAndMoveDragMoveTo(const SoPointerPosition &pos) override
SoSFTypedEnum< VoxelSnapMode > voxelSnapMode
Defines how an interactive position is snapped to the voxel grid.
bool isCreationAllowedAt(const SoPointerPosition &pos) const override
Returns whether the editor is allowed to create a new CSO at the given position, by default calls the...
void cancel() override
Cancels an action like generating a CSO. Depends on concrete editor.
SoPointingAction * selectAndMoveEndPress(int clickCount) override
SoSFBool restrictToImageBoundaries
Points can only be set/moved inside the image boundaries.
void createDragMoveTo(const SoPointerPosition &pos) override
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
The CSO represents a contour segmentation object.
Definition CSO.h:44