MeVisLab Toolbox Reference
SoCSOSplineEditor.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 
18 #include <Inventor/fields/SoSFEnum.h>
19 
22 
24 
27 {
28  SO_NODE_HEADER(SoCSOSplineEditor);
29 
30 public:
31 
34 
36  static void initClass();
37 
39  SoSFBool useFreehandMode;
41  SoSFEnum doubleClickMode;
45 
46  void createStartPressAt(const SoPointerPosition& pos) override;
47 
48  void createNewCSO( const SoPointerPosition& pos );
49  void createDragMoveTo(const SoPointerPosition& pos) override;
50  bool createEndPress(int clickCount) override;
51  void pointerPositionIfAllowedAt(const SoPointerPosition& pos) override;
52 
53  void selectAndMoveStartPressAt(const SoPointerPosition& pos) override;
54  void selectAndMoveDragMoveTo(const SoPointerPosition& pos) override;
55  SoPointingAction* selectAndMoveEndPress(int clickCount) override;
56 
58  void insertSeedPointDragMoveTo(const SoPointerPosition& pos) override;
59  SoPointingAction* insertSeedPointEndPress(int clickCount) override;
60 
61  int cursorShape() const override { return _cursorShape; }
62 
63  bool deleteSeedPoint(ml::CSO* cso, ml::CSOSeedPoint* seedPoint) override;
64 
65  void cancel() override;
66 
67 protected:
68 
70 
71 private:
72 
73  enum CSO_REACT_ON_DOUBLE_CLICK
74  {
75  CSO_SPLINE_EDITOR_DOUBLE_CLICK_SET_SINGLE_SEED = 0,
76  CSO_SPLINE_EDITOR_DOUBLE_CLICK_SET_DOUBLE_SEEDS,
77  CSO_SPLINE_EDITOR_DOUBLE_CLICK_FINISH,
78  CSO_SPLINE_EDITOR_DOUBLE_CLICK_CLOSE,
79  CSO_SPLINE_EDITOR_DOUBLE_CLICK_FINISH_NO_CLOSE
80  };
81 
82  void interpolateCSO(ml::CSO* cso);
83  bool couldCloseCSO(const SoPointerPosition& pos, ml::CSO* cso);
84  void checkCanCloseAndSetCursorShape(const SoPointerPosition& pos, ml::CSO* cso);
85  float getFirstLastSeedPointDeviceDistance(const SoPointerPosition& pos, ml::CSO* cso) const;
86 
87  void createCursorShapeChanged(SoField* field);
88 
89  SbVec3f _startPosition;
90  SoPointerPosition _startPointerPosition;
91  ml::Vector3 _currentPosition;
92 
93  int _cursorShape;
94 
95  bool _couldCloseCurrentCSO;
96 };
97 
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition: SoCSOSystem.h:21
Base class for extensions that generate line-type CSOs with special interaction on finished CSOs.
Extension for rendering, generating, and modifying a spline CSO.
ml::Vector3 getCurrentPositon(const SoPointerPosition &pos)
bool createEndPress(int clickCount) override
void insertSeedPointDragMoveTo(const SoPointerPosition &pos) override
void selectAndMoveDragMoveTo(const SoPointerPosition &pos) override
bool deleteSeedPoint(ml::CSO *cso, ml::CSOSeedPoint *seedPoint) override
Removes the given seed point from the given CSO and returns whether that was successful.
void createDragMoveTo(const SoPointerPosition &pos) override
void cancel() override
Cancels an action like generating a CSO. Depends on concrete editor.
SoPointingAction * selectAndMoveEndPress(int clickCount) override
SoSFBool shouldCloseFreehandOnRelease
Closes a freehand CSO on release, independent of the distance between the first and the last seed poi...
SoSFBool useFreehandMode
Toggles the interaction.
void insertSeedPointStartPressAt(const SoPointerPosition &pos) override
void pointerPositionIfAllowedAt(const SoPointerPosition &pos) override
Sets seed points while moving the mouse – but not while dragging.
SoPointingAction * insertSeedPointEndPress(int clickCount) override
void createNewCSO(const SoPointerPosition &pos)
static void initClass()
init class in inventor runtime
SoCSOSplineEditor()
Standard constructor.
void createStartPressAt(const SoPointerPosition &pos) override
int cursorShape() const override
Returns the cursor shape that indicates the next creation.
SoSFEnum doubleClickMode
Defines how the module should react on a double-click.
void selectAndMoveStartPressAt(const SoPointerPosition &pos) override
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
The CSOSeedPoint can be interactively set and modified and is the framework for contours.
Definition: CSOSeedPoint.h:35
The CSO represents a contour segmentation object.
Definition: CSO.h:44