MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
24{
25 SO_NODE_HEADER(SoCSOPointEditor);
26
27public:
30
37
39 POINT_DRAWING_MODE_POINT = 0,
40 POINT_DRAWING_MODE_FIXED_CROSSHAIR = 1,
41 POINT_DRAWING_MODE_CONFIGURABLE_CROSSHAIR = 2
42 };
43
45 CROSSHAIR_LINE_DIRECTION_UP = 0,
46 CROSSHAIR_LINE_DIRECTION_RIGHT = 1,
47 CROSSHAIR_LINE_DIRECTION_DOWN = 2,
48 CROSSHAIR_LINE_DIRECTION_LEFT = 3
49 };
50
53
56
61
63 void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
65
67 static void initClass();
68
69 void cancel() override;
70
71 bool isCreationAllowedAt(const SoPointerPosition& pos) const override;
72 void createStartPressAt(const SoPointerPosition& pos) override;
73 void createDragMoveTo(const SoPointerPosition& pos) override;
74 bool createEndPress(int clickCount) override;
76 {}
77
79 void selectAndMoveDragMoveTo(const SoPointerPosition& pos) override;
80 SoPointingAction* selectAndMoveEndPress(int clickCount) override;
81
82protected:
83private:
84 // move given point into image boundaries, returns true if point was modified
85 bool clipPointToImageBoundaries(ml::Vector3& point, const SoPointerPosition& pos);
86 // same for whole CSO
87 bool clipCSOToImageBoundaries(ml::CSO* cso, const SoPointerPosition& pos);
88
89 void snapToVoxelGrid(SbVec3f& position, const SoPointerPosition& pos) const;
90 void snapToVoxelGrid(ml::Vector3& position, const SoPointerPosition& pos) const;
91
92 void renderCrosshairAsPoints(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
94 void renderCrosshairAsPoints(int deviceXCenter, int deviceYCenter, const SbColor& color, float alpha) const;
95 void renderCrosshairLines(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
97 void renderCrosshairLines(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
99 void renderCrosshairLine(std::vector<ml::Vector3>& pathPoints, const CSODrawCSOInfos& csoInfos,
102 void glRenderOpaqueLine(int deviceXStart, int deviceYStart, int deviceXEnd, int deviceYEnd, const SbColor& color,
103 float alpha) const;
104 void glRenderFadingOutLine(int deviceXStart, int deviceYStart, int deviceXEnd, int deviceYEnd, const SbColor& color,
105 float alpha) const;
106
107 void fillCrosshairLinePathPoints(std::vector<ml::Vector3>& pathPoints, CrosshairLineDirection lineDirection,
108 const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos) const;
109 void glVertex2fWithMagicOffset(float x, float y) const;
110
111 bool _wasCanceled;
112
113 SbVec3f _startPosition;
114 SbVec3f _startOffset;
115};
116
#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.
SoSFInt32 gapSizeForCrosshairLines
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.
SoSFInt32 lineLengthForCrosshairLines
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
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
Class for setting visualization parameters for CSO editors.