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 
24 {
25  SO_NODE_HEADER(SoCSOPointEditor);
26 
27 public:
28 
31 
33  SoSFEnum drawingMode;
34 
37 
39  void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos, const CSODrawSliceInformation& drawSliceInfo, SoView2DCSOExtensibleEditor* editor) override;
40 
42  static void initClass();
43 
44  void cancel() override;
45 
46  bool isCreationAllowedAt(const SoPointerPosition& pos) const override;
47  void createStartPressAt(const SoPointerPosition& pos) override;
48  void createDragMoveTo(const SoPointerPosition& pos) override;
49  bool createEndPress(int clickCount) override;
51 
52  void selectAndMoveStartPressAt(const SoPointerPosition& pos) override;
53  void selectAndMoveDragMoveTo(const SoPointerPosition& pos) override;
54  SoPointingAction* selectAndMoveEndPress(int clickCount) override;
55 
57  {
58  POINT_DRAWING_MODE_POINT = 0,
59  POINT_DRAWING_MODE_CROSSHAIR = 1
60  };
61 
62 protected:
63 
64 private:
65  // move given point into image boundaries, returns true if point was modified
66  static bool clipPointToImageBoundaries(ml::Vector3& point, SoSFMLImage& image);
67  // same for whole CSO
68  static bool clipCSOToImageBoundaries(ml::CSO* cso, SoSFMLImage& image);
69 
70  void renderCrosshair(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos, const CSODrawSliceInformation& drawSliceInfo);
71  void renderCrosshair(int deviceXCenter, int deviceYCenter, const SbColor& color, float alpha) const;
72  void glRenderOpaqueLine(int deviceXStart, int deviceYStart, int deviceXEnd, int deviceYEnd, const SbColor& color, float alpha) const;
73  void glRenderFadingOutLine(int deviceXStart, int deviceYStart, int deviceXEnd, int deviceYEnd, const SbColor& color, float alpha) const;
74 
75  void glVertex2fWithMagicOffset(float x, float y) const;
76 
77  bool _wasCanceled;
78 
79  SbVec3f _startPosition;
80  SbVec3f _startOffset;
81 };
82 
#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
SoPointingAction * selectAndMoveEndPress(int clickCount) override
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.
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 SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70
The CSO represents a contour segmentation object.
Definition: CSO.h:44